www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7108] New: ICE: TraitsExp::semantic(Scope*) 2.056 -> 2.057 regression - segfault

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

           Summary: ICE: TraitsExp::semantic(Scope*)  2.056 -> 2.057
                    regression - segfault
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dlang chilon.net


--- Comment #0 from pelo <dlang chilon.net> 2011-12-14 04:47:32 PST ---
Most of my d code now causes the compiler to core dump.  All 3 of 3 projects no
longer work and only two of them share code.

Here's the backtrace I got:

Program terminated with signal 11, Segmentation fault.
#0  0x0000000000520227 in TraitsExp::semantic(Scope*) ()
#1  0x0000000000479f95 in OrOrExp::semantic(Scope*) ()
#2  0x0000000000452729 in StaticIfCondition::include(Scope*, ScopeDsymbol*) ()
#3  0x0000000000407173 in ConditionalDeclaration::include(Scope*,
ScopeDsymbol*) ()
#4  0x00000000004065e7 in StaticIfDeclaration::semantic(Scope*) ()
#5  0x0000000000406623 in StaticIfDeclaration::semantic(Scope*) ()
#6  0x0000000000406623 in StaticIfDeclaration::semantic(Scope*) ()
#7  0x00000000004fcd28 in TemplateInstance::semantic(Scope*,
ArrayBase<Expression>*)
    ()
#8  0x00000000004c3bba in TypeInstance::resolve(Loc, Scope*, Expression**,
Type**, Dsymbol**) ()
#9  0x00000000004b7936 in TypeInstance::toDsymbol(Scope*) ()
#10 0x0000000000453db2 in AliasDeclaration::semantic(Scope*) ()
#11 0x0000000000406623 in StaticIfDeclaration::semantic(Scope*) ()
#12 0x00000000004fcd28 in TemplateInstance::semantic(Scope*,
ArrayBase<Expression>*)
    ()
#13 0x0000000000458890 in Dsymbol::searchX(Loc, Scope*, Identifier*) ()
#14 0x00000000004b7a54 in TypeIdentifier::toDsymbol(Scope*) ()
#15 0x0000000000453db2 in AliasDeclaration::semantic(Scope*) ()
#16 0x00000000004fcd28 in TemplateInstance::semantic(Scope*,
ArrayBase<Expression>*)
    ()
#17 0x00000000004c3bba in TypeInstance::resolve(Loc, Scope*, Expression**,
Type**, Ds
ymbol**) ()

I'll try to narrow down the (multiple) constructs that cause this.

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



--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-12-14 07:14:50 PST ---
I found a null dereference bug in TraitsExp::semantic().
Following code kills dmd.

static assert(!__traits(hasMember, int, "x"));

In your environment, can you get similar backtrace?

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



--- Comment #2 from pelo <dlang chilon.net> 2011-12-14 07:23:09 PST ---
(In reply to comment #1)
 I found a null dereference bug in TraitsExp::semantic().
 Following code kills dmd.
 
 static assert(!__traits(hasMember, int, "x"));
 
 In your environment, can you get similar backtrace?
Yes! Here is my code: int main(string argv[]) { static assert(! __traits(hasMember, int, "x")); return 0; } I try to compile: % dmd yo.d zsh: segmentation fault (core dumped) dmd yo.d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7108



--- Comment #3 from pelo <dlang chilon.net> 2011-12-14 07:24:29 PST ---
Back trace to your simplified case above:

#0  0x0000000000520227 in TraitsExp::semantic(Scope*) ()
(gdb) bt
#0  0x0000000000520227 in TraitsExp::semantic(Scope*) ()
#1  0x000000000047a1aa in NotExp::semantic(Scope*) ()
#2  0x0000000000507115 in StaticAssert::semantic2(Scope*) ()
#3  0x00000000004e4191 in StaticAssertStatement::semantic(Scope*) ()
#4  0x00000000004ef9e4 in CompoundStatement::semantic(Scope*) ()
#5  0x000000000048f7e2 in FuncDeclaration::semantic3(Scope*) ()
#6  0x00000000004b4290 in Module::semantic3() ()
#7  0x000000000040392c in main ()

Could be the same issue.

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



--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2011-12-14 07:26:35 PST ---
Thanks. I'll post a patch to fix it.

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



--- Comment #5 from pelo <dlang chilon.net> 2011-12-14 07:30:41 PST ---
(In reply to comment #4)
 Thanks. I'll post a patch to fix it.
Thanks. I'll test your patch against my code when it's available. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7108


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code, patch
           Platform|x86_64                      |All
         OS/Version|Linux                       |All


--- Comment #6 from Kenji Hara <k.hara.pg gmail.com> 2011-12-14 21:17:07 PST ---
https://github.com/D-Programming-Language/dmd/pull/560

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #7 from Walter Bright <bugzilla digitalmars.com> 2011-12-15
00:06:22 PST ---
https://github.com/D-Programming-Language/dmd/commit/653ada953f8f0f918706d4ce6ded828ca878f39f

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 15 2011