[Issue 3323] New: Segfault or ICE(e2ir.c) using struct with destructor almost anywhere

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 17 00:40:31 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3323

           Summary: Segfault or ICE(e2ir.c) using struct with destructor
                    almost anywhere
           Product: D
           Version: 2.032
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au
        Depends on: 1894


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2009-09-17 00:40:31 PDT ---
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;  
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list