Bug 7108 – ICE: TraitsExp::semantic(Scope*) 2.056 -> 2.057 regression - segfault

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-14T04:47:00Z
Last change time
2011-12-15T00:06:22Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
dlang

Comments

Comment #0 by dlang — 2011-12-14T04:47:32Z
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.
Comment #1 by k.hara.pg — 2011-12-14T07:14:50Z
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?
Comment #2 by dlang — 2011-12-14T07:23:09Z
(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
Comment #3 by dlang — 2011-12-14T07:24:29Z
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.
Comment #4 by k.hara.pg — 2011-12-14T07:26:35Z
Thanks. I'll post a patch to fix it.
Comment #5 by dlang — 2011-12-14T07:30:41Z
(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.
Comment #6 by k.hara.pg — 2011-12-14T21:17:07Z
Comment #7 by bugzilla — 2011-12-15T00:06:22Z