Bug 3422 – ICE(cgcod.c) Structs with default initializers bigger than register size cannot be default parameters

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2009-10-20T01:52:00Z
Last change time
2014-02-16T15:23:29Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
Justin.SpahrSummers

Comments

Comment #0 by Justin.SpahrSummers — 2009-10-20T01:52:50Z
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 by clugdbug — 2009-10-20T02:09:16Z
This is the same as
Comment #2 by clugdbug — 2009-10-20T02:13:11Z
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 by clugdbug — 2009-10-20T12:19:12Z
The patch in bug 3426 fixes this (they are not the same bug, but are closely related).
Comment #4 by Kosmonaut — 2009-10-31T21:30:25Z
Comment #5 by bugzilla — 2009-11-06T11:31:24Z
Fixed dmd 1.051 and 2.036