D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2315 - DMD Stack Overflow on unwanted ctfe recursion
Summary: DMD Stack Overflow on unwanted ctfe recursion
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 critical
Assignee: Walter Bright
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2008-08-26 18:18 UTC by Frank Benoit
Modified: 2014-03-01 00:36 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Frank Benoit 2008-08-26 18:18:35 UTC
Object[] ARR_;
Object[] ARR(){
    if( ARR is null ) // type forgotten underscore
        ARR_ = [ new Object() ];
    return ARR_;
}
const Object O1 = ARR[1]; // invalid code

// results on linux in segmentation fault
Comment 1 Walter Bright 2008-08-27 00:01:56 UTC
If I put a limit on recursion in CTFE, then someone will file a bug report on the limit.

I also don't know why this is marked as critical, as removing the bug in the code will allow it to work.
Comment 2 Frank Benoit 2008-08-27 03:45:47 UTC
I marked it as critical because of the crash.
A solution can be a message in -v mode
Comment 3 Stewart Gordon 2008-11-24 09:57:36 UTC
This is in the same area as issue 1071 and possibly others, and could be dealt with in the same way (see the comments there).  Done well, nobody should have any reason to file a counter-bug to this.