[Issue 6137] New: [CTFE] Foreach on semantically wrong initialized array crashes the compiler

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 9 16:14:44 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6137

           Summary: [CTFE] Foreach on semantically wrong initialized array
                    crashes the compiler
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2011-06-09 16:10:04 PDT ---
The following (invalid) code segfaults DMD (2.053).

enum qux = foo();

int[] bar = [[]*[[]<>[]]*[]]; // can be anything that is not an int[]

int foo(){
    foreach(t;bar){}
    return 0;
}

void main(){}

It does not matter what the initializer of bar is at long as it is not an
int[].
The segmentation fault still occurs if bar is set to immutable.


Compilation output:
Error: static variable bar cannot be read at compile time
Segmentation fault

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list