[Issue 6420] New: [CTFE] ICE on dereference-assigning to a pointer casted from a literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 31 16:10:12 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6420
Summary: [CTFE] ICE on dereference-assigning to a pointer
casted from a literal
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 at puremagic.com
ReportedBy: kennytm at gmail.com
--- Comment #0 from kennytm at gmail.com 2011-07-31 16:10:10 PDT ---
Test case:
--------------
static assert( {
*cast(int*)45 = 1;
return true;
}() );
--------------
CTFE internal error: unsupported assignment *45 = 1
Assertion failed: (e1->op == TOKarraylength || e1->op == TOKvar || e1->op ==
TOKdotvar || e1->op == TOKindex || e1->op == TOKslice), function
interpretAssignCommon, file interpret.c, line 3072.
Abort trap: 6
--------------
The compiler should just fail to compile instead of ICE-ing. The number literal
45 can be replaced by a string literal and it still ICE.
Test case 2:
-----------------------
static assert( {
auto k = cast(int*)45;
*k = 1;
return true;
}() );
-----------------------
x.d(2): Error: CTFE internal error: illegal pointer value cast(int*)45u
Assertion failed: (isStackValueValid(newval)), function createStackValue, file
interpret.c, line 5165.
-----------------------
Test case 3:
-----------------------
static assert( {
*cast(float*)"a" = 4.0;
return true;
}() );
-----------------------
CTFE internal error: unsupported assignment *cast(float*)"a" = 4F
Assertion failed: (e1->op == TOKarraylength || e1->op == TOKvar || e1->op ==
TOKdotvar || e1->op == TOKindex || e1->op == TOKslice), function
interpretAssignCommon, file interpret.c, line 3072.
Abort trap: 6
-----------------------
(All test cases should *fail* to compile.)
--
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