www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6053] New: [CTFE] Two ICEs involving pointers (dereference and assign; pointer variable on stack)

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

           Summary: [CTFE] Two ICEs involving pointers (dereference and
                    assign; pointer variable on stack)
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kennytm gmail.com



Test case 1:
----------------
static assert({ int* a; return true; }());
----------------
Assertion failed: (isStackValueValid(newval)), function createStackValue, file
interpret.c, line 4070.
Abort trap
----------------



Test case 2:
----------------
static assert({ int a; *(&a) = 0; return true; }());
----------------
CTFE internal error: unsupported assignment *& a = 0
Assertion failed: (e1->op == TOKarraylength || e1->op == TOKvar || e1->op ==
TOKdotvar || e1->op == TOKindex || e1->op == TOKslice), function
interpretAssignCommon, file interpret.c, line 2380.
Abort trap
----------------
(In 2.052 this simply result in a "cannot evaluate" error, not an ICE.)



----------------
static assert({ int a, b, c; (c ? a : b) = 1; return true; }());
----------------
This causes an ICE because (c ? a : b) is rewritten to *(c ? &a : &b).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 24 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6053


kennytm gmail.com changed:

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



These codes are actually made CTFE-able. Oh well.

https://github.com/D-Programming-Language/dmd/commit/c1ae91d4149122daeab67fe76a0fe1e77cf30b79

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