6053 – [CTFE] Two ICEs involving pointers (dereference and assign; pointer variable on stack)

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6053 - [CTFE] Two ICEs involving pointers (dereference and assign; pointer variable on stack)
Summary: [CTFE] Two ICEs involving pointers (dereference and assign; pointer variable ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
Reported: 2011年05月24日 11:37 UTC by kennytm
Modified: 2011年06月10日 12:45 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2011年05月24日 11:37:43 UTC
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.)
A related test case of #2 would be
----------------
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).
Comment 1 kennytm 2011年06月10日 12:45:29 UTC
These codes are actually made CTFE-able. Oh well.
https://github.com/D-Programming-Language/dmd/commit/c1ae91d4149122daeab67fe76a0fe1e77cf30b79 


AltStyle によって変換されたページ (->オリジナル) /