D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16402 - ICE when reinterpreting a function as a long[2]
Summary: ICE when reinterpreting a function as a long[2]
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: ice, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-08-18 14:14 UTC by Cauterite
Modified: 2020-03-21 03:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Cauterite 2016-08-18 14:14:48 UTC
( https://dpaste.dzfl.pl/01922868e611 )

	void f() {};
	void main() {
		auto X = *cast(long[2]*) &f;
	};

// Internal error: backend\cod2.c 3971

The `2` in `long[2]` can be any number > 1.
On x86-32 the same bug is also triggered by `int[2]` and `uint[2]`.

This works fine:

	auto Ptr = cast(long[2]*) &f;
	auto X = *Ptr;

It can also be triggered with the enclosing function:

	void main() {
		auto X = *cast(long[2]*) &main; // Internal error …
	};