D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3422 - ICE(cgcod.c) Structs with default initializers bigger than register size cannot be default parameters
Summary: ICE(cgcod.c) Structs with default initializers bigger than register size cann...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2009-10-20 01:52 UTC by Justin Spahr-Summers
Modified: 2014-02-16 15:23 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Justin Spahr-Summers 2009-10-20 01:52:50 UTC
struct S {
	// works with double and long as well
	real a = 0, b = 0;
}

void func (S s = S()) {
	writefln("hello world");
}

void main () {
	func();
}

It appears that using "= S()" as a default parameter causes a compiler error if S contains default initializers for types larger than a register (32 bits, e.g. double, real, and long).

Full compiler error is "Internal error: ..\ztc\cgcod.c 1594"
Comment 1 Don 2009-10-20 02:09:16 UTC
This is the same as
Comment 2 Don 2009-10-20 02:13:11 UTC
This may have the same root cause as bug 2437 and bug 2935.
It also applies to D1, at least as far back as 1.020 (but didn't compile at all in 1.010), so not a regression.
Comment 3 Don 2009-10-20 12:19:12 UTC
The patch in bug 3426 fixes this (they are not the same bug, but are closely related).
Comment 4 Kosmonaut 2009-10-31 21:30:25 UTC
Fixed in SVN Repository: http://www.dsource.org/projects/dmd/changeset/230
Comment 5 Walter Bright 2009-11-06 11:31:24 UTC
Fixed dmd 1.051 and 2.036