Bug 6054 – [CTFE] ICE when returning a returned compile-time associative array containing a key of an idup-ed array literal
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-05-24T13:18:00Z
Last change time
2011-05-30T16:58:36Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-05-24T13:18:12Z
Test case:
---------------------------------
enum x = {
auto p = {
int[string] pieces;
pieces[['a'].idup] = 1;
return pieces;
}();
return p;
}();
---------------------------------
Bus error
---------------------------------
Stack trace:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x0000acbb in ArrayLiteralExp::implicitConvTo (this=0x345140, t=0x30cc10) at cast.c:524
524 Type *typeb = type->toBasetype();
(gdb) bt
#0 0x0000acbb in ArrayLiteralExp::implicitConvTo (this=0x345140, t=0x30cc10) at cast.c:524
#1 0x0000ac80 in AssocArrayLiteralExp::implicitConvTo (this=0x3451a0, t=0x310800) at cast.c:558
#2 0x0000c37d in Expression::implicitCastTo (this=0x3451a0, sc=0x344c30, t=0x310800) at cast.c:32
#3 0x000b97b4 in ExpInitializer::semantic (this=0x310d20, sc=0x344c30, t=0x310800, needInterpret=4) at mars.h:770
#4 0x00057c69 in VarDeclaration::semantic2 (this=0x310d30, sc=0x344c30) at declaration.c:1395
#5 0x000c87f2 in Module::semantic2 (this=0x30feb0) at module.c:829
#6 0x000c6268 in main (argc=5, argv=0x30ad70) at mars.c:1208
Comment #1 by kennytm — 2011-05-24T13:18:59Z
(Marking as 'regression', as the bug doesn't appear in 2.052.)