Opened 4 years ago

Closed 3 years ago

#75 closed defect (fixed)

Assertion failure in initialization of array with non-constant dimension

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

Description (last modified by Rob Schluntz)

int main() {
  enum { S = 5 };
  int a[S] = { 0, 1, 2, 3, 4 };

  const int size = 3;
  int b[size] = { 0, 1, 2 };
}

cfa test4.c
CFA Version 1.0.0 (debug)
*CFA assertion error* "false" from program "cfa-cpp" in "void ResolvExpr::ArrayIterator::setSize(Expression*)" at line 158 in file "ResolvExpr/CurrentObject.cc": unhandled expression in setSize: Variable Expression: S: const instance of enum __anonymous0 with body 1 
Stack back trace for: /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp
(0) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::ArrayIterator::setSize(Expression*)+0x112 [0x13558f2]
(1) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::ArrayIterator::setSize(Expression*)+0xc0 [0x13558a0]
(2) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::ArrayIterator::ArrayIterator(ArrayType*)+0xb5 [0x135573d]
(3) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::createMemberIterator(Type*)+0x1ac [0x1354079]
(4) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::CurrentObject::enterListInit()+0x87 [0x1354f47]
(5) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::Resolver::previsit(ListInit*)+0x56 [0x13078a0]
(6) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp() [0x1309732]
(7) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : void PassVisitor<ResolvExpr::Resolver>::call_previsit<ListInit>(ListInit*)+0x2c [0x1328cae]
(8) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : PassVisitor<ResolvExpr::Resolver>::visit(ListInit*)+0x90 [0x131c182]
(9) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ListInit::accept(Visitor&)+0x30 [0x159d24a]
(10) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : void maybeAccept_impl<Initializer, ResolvExpr::Resolver>(Initializer*, PassVisitor<ResolvExpr::Resolver>&)+0x48 [0x132521d]
(11) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : PassVisitor<ResolvExpr::Resolver>::visit(ObjectDecl*)+0xd0 [0x1314a58]
(12) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ObjectDecl::accept(Visitor&)+0x2e [0x1599252]
(13) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : void maybeAccept_impl<Declaration, ResolvExpr::Resolver>(Declaration*, PassVisitor<ResolvExpr::Resolver>&)+0x48 [0x130d8c3]
(14) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp() [0x1307fd2]
(15) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : ResolvExpr::resolve(std::__cxx11::list<Declaration*, std::allocator<Declaration*> >)+0x4a [0x1303958]
(16) /u/pabuhr/software/cfa-cc/lib/cfa/cfa-cpp : main(/*unknown*/)+0x804 [0xbb1310]
CFA Translator error: cfa-cpp failed with signal 6

Change History (2)

comment:1 Changed 4 years ago by Rob Schluntz

Description: modified (diff)
Summary: Assertion failure in initialization of array with enum dimensionAssertion failure in initialization of array with non-constant dimension

comment:2 Changed 3 years ago by Rob Schluntz <rschlunt@…>

Resolution: fixed
Status: assignedclosed

In f64d9bc:

Handle initialization of arrays with enumerator dimension and VLAs [fixes #75]

Note: See TracTickets for help on using tickets.