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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3323 - Segfault or ICE(e2ir.c) using struct with destructor almost anywhere
Summary: Segfault or ICE(e2ir.c) using struct with destructor almost anywhere
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 critical
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on: 1894
Blocks:
Show dependency tree / graph
Reported: 2009年09月17日 00:40 UTC by Don
Modified: 2015年06月09日 01:26 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2009年09月17日 00:40:31 UTC
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 Walter Bright 2010年05月30日 11:04:51 UTC
http://www.dsource.org/projects/dmd/changeset/506 


AltStyle によって変換されたページ (->オリジナル) /