Bug 9113 – ICE(interpret.c): CTFE assignment to member of struct in union
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-05T00:22:00Z
Last change time
2015-06-09T05:11:56Z
Keywords
CTFE, ice, pull
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2012-12-05T00:22:34Z
union U9113 {
struct M {
int y;
}
int xx;
}
int bug9113()
{
U9113 x;
x.M.y = 10;
return 1;
}
static assert( bug9113() );
---
dmd: interpret.c:158: void CtfeStack::setValue(VarDeclaration*, Expression*): Assertion `v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack < stackPointer()' failed.
Aborted
Comment #1 by clugdbug — 2012-12-05T02:14:37Z
This is quite amazing, the semantic pass turns the function body into:
{
U9113 x = 0;
y = 10;
return 1;
}
CTFE is complaining (correctly) that y was not declared. I'm not sure how this gets past code generation.