Opened 4 years ago

Last modified 16 months ago

#50 assigned defect

Assertion failure with tuple constructor-expressions

Reported by: Rob Schluntz Owned by: Rob Schluntz
Priority: major Component: cfa-cc
Version: 1.0 Keywords:


int main() {
  [int, int] x;
  x { [5, 5] };  // assert fail

The relevant assertion is an unhandled case in FixCtorExprs::postmutate( ConstructorExpr? *) for TupleAssignExpr?.

Change History (2)

comment:1 Changed 22 months ago by ajbeach

I may have reproduced it will a simpler case:

#include <stdlib.hfa>

int main (void) {
    int * x = alloc() { 42 };

Error message:

CFA Version 1.0.0 (debug)
*CFA assertion error* "ret" from program "cfa-cpp" in "T strict_dynamic_cast(const U&) [with T = ast::EnumDecl*; U = ast::Node*]" at line 49 in file "./include/cassert": union __anonymous0: with body : yes 

Stack back trace for: /u0/ajbeach/cfa-cc/lib/cfa/cfa-cpp
(0) /u0/ajbeach/cfa-cc/lib/cfa/cfa-cpp : ConverterOldToNew::visit(EnumInstType*)+0xdd [0x79686d]

The code that is failing here did not exist at the time the original ticket was filed. However it gets this error message now

comment:2 Changed 16 months ago by Thierry Delisle

#include <stdlib.hfa>

int main (void) {
    int * x = alloc() { 42 };

Doesn't seem to cause a problem anymore as of eeaa3e2b4b50ff73386830c663367b7ad89482e1

The assert still breaks on the original snippet.
The offending code is prefixed with "xxx - this can be TupleAssignExpr? now. Need to properly handle this case."

The crash is indeed due to a strict cast to ApplicationExpr? of a node that is a TupleAssignExpr?.

It's in the FixCtorExprs? which "Expands ConstructorExpr? nodes into comma expressions, using a temporary for the first argument"

Note: See TracTickets for help on using tickets.