[Issue 7379] New: DMD segfaults on semantic3 phase when alias enum this;

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 27 11:05:14 PST 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 at puremagic.com
        ReportedBy: nazriel6969 at gmail.com


--- Comment #0 from Damian Ziemba <nazriel6969 at 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: -------


More information about the Digitalmars-d-bugs mailing list