D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 925 - ICE on casting array literal to void[]
Summary: ICE on casting array literal to void[]
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: Walter Bright
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2007-02-03 04:09 UTC by Matti Niemenmaa
Modified: 2014-02-16 15:24 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Matti Niemenmaa 2007-02-03 04:09:51 UTC
Probably related to Issue 720 in some way, as it's the same error: "Internal error: ..\ztc\cod1.c 2526".

void main() {
	cast(void[])[1];
}
Comment 1 Thomas Kühne 2007-04-05 11:33:30 UTC
Added to DStress as
http://dstress.kuehne.cn/run/b/bug_cod1_2528_C.d
Comment 2 Unknown W. Brackets 2009-03-30 00:49:11 UTC
This test now passes with DMD 1.041 and 2.026.

-[Unknown]
Comment 3 Robert Clipsham 2009-11-07 08:01:58 UTC
This test case is failing in dmd 1.051. The ICE has gone, but the result at runtime is incorrect.

----
module dstress.run.b.bug_cod1_2528_C;

int main(){
        auto x = cast(void[])[1];
        return x.length - 1;
}
----

Returns 3 instead of 0.
Comment 4 Don 2009-11-13 04:12:15 UTC
The DStress test case is incorrect. The arrray literal is an int, so it's 4 bytes. Casting it to void[] should give a length of 4 -- and that's exactly what it does.