Bug 1719 – Compiler crash or unstable code generation with scoped interface instances
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2007-12-09T11:24:00Z
Last change time
2015-06-09T05:15:00Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
jason.james.house
Comments
Comment #0 by jason.james.house — 2007-12-09T11:24:43Z
The bottom of this post contains code that reproduces the problem.
It's known to cause issues with the following conditions:
dmd 1.018, windows, tango
dmd 1.023, linux, tango
It's known to not cause issues with the following conditions:
dmd 1.023, linux, phobos
dmd 1.024, ???, phobos
gdc 0.24, linux, tango
gdc 0.24, linux-64, phobos
It looks to be specific to the combination of dmd and tango. It has not been tested with dmd 2.x.
////////////////////////////////////////////
// CODE
////////////////////////////////////////////
version=crash;
//version=work1;
//version=work2;
//version=work3;
interface I{
}
class C : public I{
}
unittest{
version(crash) scope I def = new C;
version(work1) scope C def = new C;
version(work2) I def = new C;
version(work3) C def = new C;
}
int main(){
return 0;
}
Comment #1 by matti.niemenmaa+dbugzilla — 2007-12-09T11:41:53Z
Works fine for me with DMD 1.024 on Windows, with both Phobos and Tango.
Comment #2 by sean — 2007-12-10T13:33:12Z
Odd. This crashes for me with DMD 1.024 and DMD 2.008 on Win32 using both Phobos and Tango. The crash occurs when I try to step into the unit test routine for the module in question (using ddbg), but the ModuleInfo object is valid.
Comment #3 by matti.niemenmaa+dbugzilla — 2007-12-11T03:42:30Z
Alright, forget what I said. I completely missed the fact that the code is in a unittest block.
Compiling with -unittest, I get an Access Violation with Phobos and an outright crash with Tango.
Comment #4 by bugzilla — 2008-01-20T02:13:32Z
The problem is interfaces cannot be deleted. To work around:
scope c = new C();
I def = c;
Comment #5 by larsivar — 2008-01-22T17:14:10Z
Do you consider it a bug that the interface isn't deletable? Such that this entry should be kept open?
Comment #6 by larsivar — 2008-01-22T17:30:32Z
>
> ------- Comment #5 from [email protected] 2008-01-22 17:14 -------
> Do you consider it a bug that the interface isn't deletable? Such that
> this entry should be kept open?
>
>
> --
Never mind, I suppose Walter would close it if he found it invalid.
Comment #7 by bugzilla — 2008-02-16T06:03:24Z
Fixed dmd 1.026 and 2.010
Comment #8 by larsivar — 2008-02-16T06:11:14Z
[email protected] wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=1719
>
>
> [email protected] changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEW |RESOLVED
> Resolution| |FIXED
>
>
>
>
> ------- Comment #7 from [email protected] 2008-02-16 06:03 -------
> Fixed dmd 1.026 and 2.010
>
>
> --
I don't consider the error in 1.026. What seems to be the fix in 1.027
should do it however.