1613 – DMD hangs on syntax error

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1613 - DMD hangs on syntax error
Summary: DMD hangs on syntax error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: Walter Bright
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
Reported: 2007年10月24日 21:31 UTC by Ary Borenszweig
Modified: 2014年02月16日 15:23 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Ary Borenszweig 2007年10月24日 21:31:26 UTC
Compiling this piece of code:
--
int x = {
--
makes dmd's parser loop inifitenly, consuming the machine's memory. It also happens in 1.020.
Although no one would ever write such a code, if the parser is ported and used for an IDE, it may freeze the IDE (I found it in Descent). There, it's very normal if the user stops typing at "{".
Fix: in parser.d, Parser::parseInitializer, after the first loop after "braces = 1;", in the swich of the loop add a "case TOKeof:" which breaks out of the for (I'm seeing a goto there :-P). A "break" must also be added in the next while(1) loop, also in a new "case TOKeof:".
Comment 1 Aziz Köksal 2007年11月02日 15:56:20 UTC
I've reported this issue already here: http://d.puremagic.com/issues/show_bug.cgi?id=1356 
Comment 2 Walter Bright 2007年11月03日 21:50:43 UTC
Fixed dmd 1.023 and 2.007


AltStyle によって変換されたページ (->オリジナル) /