Bug 1072 – CTFE: crash on for loop with blank increment

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-03-20T02:44:00Z
Last change time
2014-02-16T15:26:25Z
Keywords
ice-on-valid-code, patch
Assigned to
bugzilla
Creator
davidl

Comments

Comment #0 by davidl — 2007-03-20T02:44:17Z
static char[] hello() { char[] result=""; for(;;) result ~= `abc`; return result; } void main() { pragma(msg,hello()); } this code should also make ur computer DoS, but DMD AV
Comment #1 by thomas-dloop — 2007-04-04T15:36:30Z
Comment #2 by davidl — 2007-09-15T11:33:45Z
this code won't make dmd access violation: static char[] hello() { char[] result=""; int i; for(;;i++) result ~= `abc`; return result; } void main() { pragma(msg,hello()); } the problem is intepret.c line 594, it assumes increment is an object which is never null, while in this case, the loop doesn't have any increment statement. So a quick fix is add to line 594 if (!increment) continue;
Comment #3 by davidl — 2007-12-09T19:17:19Z
*** Bug 1696 has been marked as a duplicate of this bug. ***
Comment #4 by clugdbug — 2007-12-18T09:27:29Z
added keywords. Walter probably missed this one because the bug title is terrible!
Comment #5 by matti.niemenmaa+dbugzilla — 2007-12-18T12:30:55Z
So make it less terrible.
Comment #6 by davidl — 2007-12-19T04:54:36Z
haha, you guys are right.
Comment #7 by bugzilla — 2008-02-16T06:08:48Z
Fixed dmd 1.026