Bug 6177 – Regression(2.053): ICE backend/cgcs.c: struct with destructor in assoc. array or typesafe variadic functions
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-19T09:06:00Z
Last change time
2012-01-19T10:51:54Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
jsancio
Comments
Comment #0 by jsancio — 2011-06-19T09:06:45Z
I am hitting what I believe is a dmd bug when I try to insert into an AA that points to a struct that contains a struct with a destructor. The following code yields an error:
struct Parent
{
struct Child
{
AnotherStruct another;
}
struct AnotherStruct
{
~this() {}
}
void fun()
{
map[0] = Selection.init;
}
Child[int] map;
}
void main()
{}
---
dmd -w map_test.d
Internal error: backend/cgcs.c 162
Note: I am using the latest master.
Comment #1 by andrei — 2011-06-19T09:24:50Z
Where is Selection?
Comment #2 by jsancio — 2011-06-19T09:28:51Z
(In reply to comment #1)
> Where is Selection?
Oops, Sorry. It should be Child.init.
Was trying to simplify my Select/Socket project that uses struct for RAII and forgot to remove all the domain specific references...
Comment #3 by kennytm — 2011-06-19T10:41:06Z
Reduced:
-----------------------------------------
struct Bug6177 {
~this() {}
}
void main() {
cast(void) [0: Bug6177.init];
}
-----------------------------------------
Internal error: backend/cgcs.c 162
-----------------------------------------
Strangely, the error does not appear when -O *is* supplied.
Comment #4 by kennytm — 2011-06-19T10:45:58Z
This is a regression introduced somewhere between 2.052 and 2.053 (for Mac OS X).
Comment #5 by jsancio — 2011-06-19T10:48:55Z
(In reply to comment #3)
> Strangely, the error does not appear when -O *is* supplied.
Very nice, my code compiles with -O. I'll use that as a work around for now!
I'm getting the very same ICE with the following code:
struct F
{
~this() {}
}
struct G
{
this(F[] p...) {}
}
void main()
{
F c;
G g = G(c);
}
DMD v2.054
Comment #8 by webby — 2011-10-20T08:15:12Z
I'm getting this when trying to compile the Juno library with the latest DMD source.
The crash there seems to reduce to:
////////////////
struct foo
{
~this()
{
}
}
void bar(foo[] args...)
{
}
void main()
{
bar();
}
////////////////
It's ok if i compile it with -O.