Opened 13 months ago

#180 new defect

Assertion Failure Due to Missing sized

Reported by: ajbeach Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

The following code has an error which is not caught and reported but instead triggers an assertion failure:

forall(dtype T)
struct wrap {
    T object;
};

forall(dtype T | sized(T) | { void ?{}(T &); }) 
void ?{}(wrap(T) & this) { 
    (this.object){};
}

The assertion error and paired stack trace is:

cfa-cpp: GenPoly/Box.cc:1193: Expression* GenPoly::{anonymous}::Pass1::postmutate(AddressExpr*): Assertion `addrExpr->arg->result && ! addrExpr->arg->result->isVoid()' failed.
Stack back trace for: /u0/ajbeach/cfa-cc/driver/cfa-cpp
(0) /lib/x86_64-linux-gnu/libc.so.6 : (/*unknown*/)+0x2dc82 [0x7ffff723bc82]
(1) /u0/ajbeach/cfa-cc/driver/cfa-cpp() [0xd8d1f0]
...
(14) /u0/ajbeach/cfa-cc/driver/cfa-cpp : GenPoly::box(std::__cxx11::list<Declaration*, std::allocator<Declaration*> >&)+0xa46 [0xdcebe6]
(15) /u0/ajbeach/cfa-cc/driver/cfa-cpp : main(/*unknown*/)+0xc8c [0x94baac]
CC1 Translator error: stage 2, child failed 6

A check with a user facing error message should be added to prevent this from happening and to highlight the actual fix (adding | sized(T) to the struct forall).

Change History (0)

Note: See TracTickets for help on using tickets.