www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: clugdbug yahoo.com.au
        Depends on: 1894


--- Comment #0 from Don <clugdbug 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: -------
Sep 17 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3323


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2010-05-30
11:04:51 PDT ---
http://www.dsource.org/projects/dmd/changeset/506

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