www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8742] New: Anonymous nested class derived from another nested class makes DMD crash

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742

           Summary: Anonymous nested class derived from another nested
                    class makes DMD crash
           Product: D
           Version: D1 & D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: david.eckardt sociomantic.com



06:29:21 PDT ---
When compiling the following example module, DMD 1.075 or 2.060 crashes with
Segmentation Fault with -version=Crash; it does not without.

---
module crash;

class C
{
    class D { }
}

void main ( )
{
    auto c = new C;

    version(Crash) auto d = c.new class C.D { };
} 
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



07:30:02 PST ---
Is this valid code to begin with?

 Kenji  Walter: `toParent2()->getType()` returns NULL, hence isBaseOf crashes
when it tries to call `t->ty` on a NULL `t`. I can add a check to `isBaseOf`,
then it will return:

test.d(11): Error: class test.main.__anonclass1 is nested within main, but
super class D is nested within C
test.d(11): Error: e.new is only for allocating nested classes

So it would turn the ICE into an error, but is that ok or is the code actually
valid?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742




10:43:28 PST ---
It sounds plausible to me that the code is invalid due to wrong nesting; I
didn't notice that, sorry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742





 Is this valid code to begin with?
 
  Kenji  Walter: `toParent2()->getType()` returns NULL, hence isBaseOf crashes
 when it tries to call `t->ty` on a NULL `t`. I can add a check to `isBaseOf`,
 then it will return:
 
 test.d(11): Error: class test.main.__anonclass1 is nested within main, but
 super class D is nested within C
 test.d(11): Error: e.new is only for allocating nested classes
 
 So it would turn the ICE into an error, but is that ok or is the code actually
 valid?
Seems reasonable. In the case, anonymous class typeof(d) requires two context pointers, one is of 'c', one another is of 'main'. But it is disallowed. So, the original code should be an error in my opinion. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 11 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86_64                      |All
         OS/Version|Linux                       |All



08:12:35 PST ---
https://github.com/D-Programming-Language/dmd/pull/1466

D2 only. But D1 is officially deprecated, so what happens next? Will walter
merge it into D1? I'll bring the popcorn!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2e20e68eae3473b514d7cfa0275afa704c6990df
Fixes Issue 8742 - ICE on anon class derived from nested class.

https://github.com/D-Programming-Language/dmd/commit/c55d4ef45989574dddaa32f2e174bf5c5d0da90b


Issue 8742 - ICE on anon class derived from nested class.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8742


Walter Bright <bugzilla digitalmars.com> changed:

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


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