Bug 716 – -inline: conditinal compilation of an empty foreach body causes the compiler to segfault

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-12-22T07:24:00Z
Last change time
2014-02-15T13:22:11Z
Keywords
ice-on-valid-code, patch
Assigned to
bugzilla
Creator
thomas-dloop

Comments

Comment #0 by thomas-dloop — 2006-12-22T07:24:24Z
(Originally posted by Stewart Gordon <[email protected]> on 2005-04-18 as news:[email protected]) # # int main(char[][] args) { # foreach(char[] p; args){ # version(dummy) int i; # } # return 0; # } # compiling with "dmd -inline sample.d" causes the compiler to segfault test cases: http://dstress.kuehne.cn/run/foreach_28.d http://dstress.kuehne.cn/run/foreach_29.d http://dstress.kuehne.cn/run/f/foreach_28_B.d
Comment #1 by thomas-dloop — 2007-03-02T08:28:00Z
*** Bug 990 has been marked as a duplicate of this bug. ***
Comment #2 by bugzilla — 2007-10-30T22:58:19Z
Works with dmd 1.022 and 2.006
Comment #3 by davidl — 2007-11-08T07:05:30Z
a patch is required. inline.c 857 Statement *ForeachStatement::inlineScan(InlineScanState *iss) { aggr = aggr->inlineScan(iss); if(body) body = body->inlineScan(iss); return this; }
Comment #4 by clugdbug — 2009-04-01T07:19:12Z
Works for me. The code in DMD 2.027 is exactly as described by David. I guess it was fixed at some point.