Thread overview
[Issue 7379] New: DMD segfaults on semantic3 phase when alias enum this;
Jan 27, 2012
Damian Ziemba
Jan 29, 2012
Walter Bright
January 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7379

           Summary: DMD segfaults on semantic3 phase when alias enum this;
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: nazriel6969@gmail.com


--- Comment #0 from Damian Ziemba <nazriel6969@gmail.com> 2012-01-27 11:05:07 PST ---
// -----
struct Test
{

    enum ENUM
    {
        M1,
        M2,
        M3
    }
    alias ENUM this;
}

class Test2
{
    this(Test test)
    {
    }

    this(string test)
    {
        this(Test());
    }
}

void main() {}
// ---

This code snippet cause DMD to segfault on semantic3 phase. Backtracing showes that problem occurs in mtype.c: 7804

gdb dmd ./run -c ./test.d

Full backtrace:
// ---
#0  0x00000000004c6450 in TypeStruct::wildConvTo(Type*) ()
No symbol table info available.
#1  0x00000000004ca02b in TypeFunction::callMatch(Expression*,
ArrayBase<Expression>*, int) ()
No symbol table info available.
#2  0x000000000048e745 in fp2(void*, FuncDeclaration*) ()
No symbol table info available.
#3  0x000000000048e164 in overloadApply(FuncDeclaration*, int (*)(void*,
FuncDeclaration*), void*) ()
No symbol table info available.
#4  0x000000000048e22d in overloadResolveX(Match*, FuncDeclaration*,
Expression*, ArrayBase<Expression>*) ()
No symbol table info available.
#5  0x000000000048e2b2 in FuncDeclaration::overloadResolve(Loc, Expression*,
ArrayBase<Expression>*, int) ()
No symbol table info available.
#6  0x0000000000488534 in CallExp::semantic(Scope*) ()
No symbol table info available.
#7  0x00000000004ebe7b in ExpStatement::semantic(Scope*) ()
No symbol table info available.
#8  0x00000000004f4254 in CompoundStatement::semantic(Scope*) ()
No symbol table info available.
#9  0x0000000000491ea2 in FuncDeclaration::semantic3(Scope*) ()
No symbol table info available.
#10 0x00000000004f5bd8 in AggregateDeclaration::semantic3(Scope*) ()
No symbol table info available.
#11 0x00000000004b7a00 in Module::semantic3() ()
No symbol table info available.
#12 0x0000000000403aec in main ()
// ---

I've noticed this problem since 2.056.
At the moment using DMD from Git 2.058.

Operating system:
//---
Linux d3 3.0.6-gentoo #1 SMP Sun Oct 9 12:00:00 CEST 2011 x86_64 Intel(R)
Core(TM) i5 CPU M 450 @ 2.40GHz GenuineIntel GNU/Linux
//---

Occurs also on FreeBSD and MacOSX.
With both -m32 and -m64.
Not tested on Windows tho.

Removing
//---
alias ENUM this;
//---

From test case solves problem.

Best Regards,
Damian Ziemba

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7379



--- Comment #1 from github-bugzilla@puremagic.com 2012-01-29 00:22:01 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5adc29b322bbeaa162e2d731edf014c989fdfe60 fix Issue 7379 - DMD segfaults on semantic3 phase when alias enum this

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7379


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: -------