www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6137] New: [CTFE] Foreach on semantically wrong initialized array crashes the compiler

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: timon.gehr gmx.ch



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: -------
Jun 09 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6137


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression



This bug is introduced with DMD 2.053.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 10 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6137


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



Fixed in git master, as part of the fixes to CTFE references.
https://github.com/D-Programming-Language/dmd/pull/69

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