www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8988] New: Segfault in tricky CTFE scenario

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

           Summary: Segfault in tricky CTFE scenario
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



Crashes DMD 2.060, should pass compilation:

template ID(alias T){ alias T ID; }
template GetParent(T){
    alias ID!(mixin((()=>(new T).foo())())) GetParent;
}
class B{ auto foo(){ return "A"; }}
class A: GetParent!A{
    override foo(){ return "B"; }
}

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


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

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



08:55:09 PST ---
Slightly reduced:

template GetParent(T)
{
    alias Object GetParent;
    enum x = (()=>(new A()).foo())();
}

class A : GetParent!A
{
    string foo(){ return "Object"; }
}

The segfault is in ClassDeclaration::searchBase:

Dsymbol *cdb = b->type->isClassHandle();
    if (cdb->ident->equals(ident))  // offending line

cdb is not checked for NULL.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Segfault in tricky CTFE     |Segfault with circular
                   |scenario                    |derived class template



Not related to CTFE, also applies to D1. Bit hard to describe.
Reduced test case:
----

template Bug8988(T)
{
    alias Object xxx;
    alias typeof( A8988.init.foo) zzz;
}

class A8988 : Bug8988!(A8988).xxx
{
    alias int foo;
}

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




This might be the same as bug 8466. At least, it is segfaulting in the same
place.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



23:52:02 PDT ---
All test cases compile successfully with 2.064 head.

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