Bug 4864 – ICE(statement.c) Crash on invalid 'if statement' body inside mixin

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-09-14T00:01:00Z
Last change time
2010-12-08T01:02:06Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
yebblies

Comments

Comment #0 by yebblies — 2010-09-14T00:01:51Z
----- reduced test case ----- void main() { mixin("if (0) % ;"); } ----------------------------- IfStatement::semantic is called with (ifbody == null) Seems like something that should be detected during parsing of the mixin.
Comment #1 by yebblies — 2010-09-15T02:13:58Z
Additional test case: void main() { mixin("if (a b) ;"); } Another case of a broken if statement. The crash goes away if a body is added to the if statement.
Comment #2 by clugdbug — 2010-11-17T00:13:39Z
PATCH: statement.c 337. CompileStatement::flatten() Statements *a = new Statements(); while (p.token.value != TOKeof) { + int olderrs = global.errors; Statement *s = p.parseStatement(PSsemi | PScurlyscope); + if (olderrs == global.errors) // discard it if parsing failed a->push(s); }
Comment #3 by bugzilla — 2010-12-04T22:57:08Z
Comment #4 by bugzilla — 2010-12-04T22:57:26Z