www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3026] New: ICE using static array initializer at compile time

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3026

           Summary: ICE using static array initializer at compile time
           Product: D
           Version: 2.030
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: ice-on-valid-code, patch, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: rsinfu gmail.com


Created an attachment (id=382)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=382)
Fix the problem (dmd 2.030)

DMD dies without any error message compiling this valid code:
--------------------
immutable int[2] array = [ 42 ];
enum e = array[1];
--------------------
The array initializer in this code contains one element. In this case
ArrayInitializer::toExpression() wrongly generates an ArrayLiteralExp
of one element, not two elements (notice the int[2]). Then DMD references
missing second element, and dies. The patch fixes this problem.

And DMD rejects this valid code:
--------------------
immutable int[1] array = [ 0: 42 ];
enum e = array[0];
--------------------
test.d(1): Error: array initializers as expressions are not allowed
test.d(1): Error: array initializers as expressions are not allowed
test.d(1): Error: array initializers as expressions are not allowed
test.d(1): Error: array initializers as expressions are not allowed
--------------------
ArrayInitializer::toExpression() does not implement support for array
index in static array initializers. The patch also implements it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 26 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3026






---
Created an attachment (id=390)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=390)
Additional patch: fix segfault on fwdref

ArrayInitializer will cause a segfault when it's forward referenced. Please
apply this patch in addition to the first patch.

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





02:51:01 PDT ---
Fixed dmd 1.046 and 2.031

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