Bug 3323 – Segfault or ICE(e2ir.c) using struct with destructor almost anywhere

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2009-09-17T00:40:00Z
Last change time
2015-06-09T01:26:48Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
clugdbug
Depends on
1894

Comments

Comment #0 by clugdbug — 2009-09-17T00:40:31Z
This is similar to bug 1894, except that obviously it's D2 only and it ICEs rather than generating bad code. Segfaults in expression.c, CallExp::checkSideEffect(). All members seem to be corrupt. The only cases which work are compound statements, labels, foreach, and scope guards. If the destructor will never be called, it ICEs in e2ir instead. This is a structural problem, I can't patch it. Deterministic destruction is broken. Here are 14 test cases. It's very easy to find more. ===== struct A{ ~this() { } } // Any of these lines cause a segfault void segfault(){ if (1) A a; //if(0) {} else A a; //for(A a;;) {} //for(;;) A a; //do A a; while(0); //while(1) A a; //try A a; catch(Error e) {} //switch(1) A a; // final switch(0) A a; //A a; with(a) A b; } // Any of these lines cause an ICE(e2ir.c) void e2ir(){ // while(0) A a; // if(0) A a; // if(1){} else A a; // for(;0;) A a; }
Comment #1 by bugzilla — 2010-05-30T11:04:51Z