← Back to index
|
Original Bugzilla link
Bug 4925 – [ICE] segfault with module-scope assert(0)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-09-23T13:34:00Z
Last change time
2015-06-09T05:11:57Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
rsinfu
Comments
Comment #0
by rsinfu — 2010-09-23T13:34:12Z
The following code crashes the compiler: const int a = (assert(0), 1); Patch: --- src/expression.c +++ src/expression.c @@ -5695,8 +5695,11 @@ Expression *AssertExp::semantic(Scope *sc) } if (e1->isBool(FALSE)) { - FuncDeclaration *fd = sc->parent->isFuncDeclaration(); - fd->hasReturnExp |= 4; + if (sc->parent && sc->parent->isFuncDeclaration()) + { + FuncDeclaration *fd = sc->parent->isFuncDeclaration(); + fd->hasReturnExp |= 4; + } if (!global.params.useAssert) { Expression *e = new HaltExp(loc);
Comment #1
by bugzilla — 2010-09-27T19:57:26Z
http://www.dsource.org/projects/dmd/changeset/694