Bug 1696 – for(;;) in CTFE segfaults compiler

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-11-28T02:00:00Z
Last change time
2014-02-24T15:33:52Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2007-11-28T02:00:00Z
Seems it's not checking for an empty iteration clause. Putting _anything_ in there, eg for(;;null) stops the segfault. --------- int a() { bool b = false; for (;;) { if (b) return 0; b = true; } } const c = a();
Comment #1 by ary — 2007-11-28T08:00:26Z
[email protected] wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=1696 > > Summary: for(;;) in CTFE segfaults compiler > Product: D > Version: 1.023 > Platform: PC > OS/Version: Windows > Status: NEW > Severity: normal > Priority: P2 > Component: DMD > AssignedTo: [email protected] > ReportedBy: [email protected] > > > Seems it's not checking for an empty iteration clause. > Putting _anything_ in there, eg for(;;null) stops the segfault. > --------- > int a() > { > bool b = false; > for (;;) { > if (b) return 0; > b = true; > } > } > > const c = a(); > > What if there is a break somewhere in the empty for? The compiler can't know that the function will end it's execution. I think it would be weird if the compiler didn't hang up or segfault on this.
Comment #2 by smjg — 2007-11-28T08:25:51Z
Ary, what do you mean by this? And please don't quote the entire message posted to the newsgroup when replying. It's bad enough on any newsgroup, and when it clutters up Bugzilla, it's even worse.
Comment #3 by ary — 2007-11-28T10:35:20Z
Sorry, I meant nothing. I was very drowsy I guess.
Comment #4 by davidl — 2007-12-09T19:17:19Z
*** This bug has been marked as a duplicate of 1072 ***