Bug 14240 – Segfault while compiling templated code

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-03T18:22:00Z
Last change time
2015-06-04T06:08:53Z
Assigned to
nobody
Creator
lord_sigma

Attachments

IDFilenameSummaryContent-TypeSize
1479file_14240.txtGDB's backtracetext/plain1582

Comments

Comment #0 by lord_sigma — 2015-03-03T18:22:12Z
Created attachment 1479 GDB's backtrace Dustmited source: ----- // A.d struct C(string E ) {} import std.typetuple; alias I = TypeTuple!(C!K); enum K = M; ----- DMD version 2.066 and git crash on my system whenever I try to run dmd A.d . GDB's backtrace: #0 0x00000000004713da in ctfeInterpret(Expression*) () #1 0x000000000044e4b9 in TemplateValueParameter::matchArg(Scope*, RootObject*, unsigned long, Array<TemplateParameter*>*, Array<RootObject*>*, Declaration**) () #2 0x000000000045715e in TemplateDeclaration::matchWithInstance(Scope*, TemplateInstance*, Array<RootObject*>*, Array<Expression*>*, int) () #3 0x000000000045784d in TemplateInstance::findBestMatch(Scope*, Array<Expression*>*)::ParamBest::fp(void*, Dsymbol*) () #4 0x00000000004f2ce6 in overloadApply(Dsymbol*, void*, int (*)(void*, Dsymbol*)) () #5 0x0000000000457c97 in TemplateInstance::findBestMatch(Scope*, Array<Expression*>*) () #6 0x000000000045c7b9 in TemplateInstance::semantic(Scope*, Array<Expression*>*) () #7 0x0000000000419c54 in TypeInstance::resolve(Loc, Scope*, Expression**, Type**, Dsymbol**, bool) () #8 0x0000000000455ea0 in TemplateInstance::semanticTiargs(Loc, Scope*, Array<RootObject*>*, int) () #9 0x0000000000456a2e in TemplateInstance::semanticTiargs(Scope*) [clone .part.55] () #10 0x000000000045ca1b in TemplateInstance::semantic(Scope*, Array<Expression*>*) () #11 0x0000000000419c54 in TypeInstance::resolve(Loc, Scope*, Expression**, Type**, Dsymbol**, bool) () #12 0x0000000000409f4d in TypeInstance::toDsymbol(Scope*) () #13 0x00000000004c126e in AliasDeclaration::semantic(Scope*) () #14 0x0000000000407c65 in Module::semantic() () #15 0x0000000000404e5c in tryMain(unsigned long, char const**) () #16 0x00007ffff7015ab5 in __libc_start_main () from /lib64/libc.so.6 #17 0x0000000000402cf5 in _start ()
Comment #1 by ketmar — 2015-06-04T02:47:38Z
diff --git a/src/interpret.c b/src/interpret.c index 9b358e9..bb3e2c3 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -730,7 +730,7 @@ Expression *ctfeInterpret(Expression *e) return e; assert(e->type); // Bugzilla 14642 //assert(e->type->ty != Terror); // FIXME - if (e->type->ty == Terror) + if (!e->type || e->type->ty == Terror) return new ErrorExp(); unsigned olderrors = global.errors;
Comment #2 by k.hara.pg — 2015-06-04T06:08:35Z
This is a regression from 2.066, and a dup of issue 14642 - it's timely fixed today. (In reply to Ketmar Dark from comment #1) > diff --git a/src/interpret.c b/src/interpret.c > index 9b358e9..bb3e2c3 100644 > --- a/src/interpret.c > +++ b/src/interpret.c > @@ -730,7 +730,7 @@ Expression *ctfeInterpret(Expression *e) > return e; > assert(e->type); // Bugzilla 14642 --> This line now asserts the segfault issue won't reproduce. > //assert(e->type->ty != Terror); // FIXME > - if (e->type->ty == Terror) > + if (!e->type || e->type->ty == Terror) > return new ErrorExp(); > > unsigned olderrors = global.errors; *** This issue has been marked as a duplicate of issue 14642 ***