Bug 11054 – ICE: interpret.c:357: virtual void Statement::ctfeCompile(CompiledCtfeFunction*): Assertion `0' failed.

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-16T20:43:00Z
Last change time
2013-09-19T07:08:27Z
Keywords
ice, pull
Assigned to
nobody
Creator
hsteoh

Attachments

IDFilenameSummaryContent-TypeSize
1249ice11054.tar.gzTest case reduced from a suitably altered version of Phobosapplication/x-gzip786

Comments

Comment #0 by hsteoh — 2013-09-16T20:43:43Z
Code: ------ import std.traits; ------ Compile command: dmd -property -unittest -c /tmp/test.d Compiler output: ------ dmd: interpret.c:357: virtual void Statement::ctfeCompile(CompiledCtfeFunction*): Assertion `0' failed. Aborted ------
Comment #1 by hsteoh — 2013-09-16T20:51:31Z
lol... here's a "reduced" test case (made from std.traits via dustmite): ------ import std.typetuple; ------ :)
Comment #2 by hsteoh — 2013-09-16T20:56:04Z
OK, this is a bit screwy, but I just tried reducing std.typetuple, and it reduces back to `import std.traits`. So I've no idea what the real cause is now. :-P
Comment #3 by hsteoh — 2013-09-16T21:10:51Z
More info: dmd -v indicates that the ICE happens at 'semantic2 traits'.
Comment #4 by hsteoh — 2013-09-16T21:37:16Z
Argh. I can't seem to narrow down actual code that causes the ICE. Dustmite always reduces it to just a single import statement. First it was std.traits -> import std.typetuple, then std.typetuple -> import std.traits, then when I copied both std.traits and std.typetuple into the test directory, it reduces to import std.algorithm. After several tries, I finally copied std.{traits,algorithm,typetuple} into the test dir and renamed them along with all import references to them (so that they don't pick up the original Phobos version), and now dustmite reduces it to import std.typecons. So it seems to be a wild goose chase. I still have no idea what's going on here.
Comment #5 by andrej.mitrovich — 2013-09-17T04:28:23Z
I can't even compile git-head with -property, but that's not a big issue since we're going to deprecate this switch soon. ----- import std.typetuple; ----- ----- import std.traits; ----- ----- C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\conv.d(1228): Error: not a property toStringRadixConvert ... many more errors here ----- I get no ICE though. Which commits are you testing with?
Comment #6 by hsteoh — 2013-09-17T08:11:27Z
Created attachment 1249 Test case reduced from a suitably altered version of Phobos This is a reduced test case created by running dustmite on a copy of Phobos with all instances of "std" replaced with "dts" so that it will not actually import real Phobos code.
Comment #7 by hsteoh — 2013-09-17T08:25:04Z
(In reply to comment #5) > I can't even compile git-head with -property, but that's not a big issue since > we're going to deprecate this switch soon. > > ----- > import std.typetuple; > ----- > > ----- > import std.traits; > ----- > > ----- > C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\conv.d(1228): Error: not a > property toStringRadixConvert > ... > many more errors here > ----- > > I get no ICE though. Which commits are you testing with? Heh, just saw your comment (didn't refresh the page this morning so missed it). I'm testing dmd git HEAD (e87199a75c504a668b117d7b9a99edc54aa2e4d0), druntime git HEAD (43110e794461d0725f191028a6e3bf28d4d45e2d), and phobos git HEAD (a54bc74277427133baf59185be36d7a5cb1de1a4). The compile environment is Linux/64-bit.
Comment #8 by hsteoh — 2013-09-17T08:27:39Z
Still happening on dmd commit 9a321180e0c74f0c8006a8ebb70f18f371ec44c2.
Comment #9 by andrej.mitrovich — 2013-09-17T11:17:24Z
Ok I can reproduce it with the test-case from #c6. I've compiled with: dmd -unittest test.d Where test.d is: import dts.traits; void main() { } Stack-trace: 0018b57c 0045ef8a image00400000!Statement::ctfeCompile+0x25 [C:\dmd-git\dmd2\src\dmd\src\interpret.c @ 357] 0018b5a4 0045f6a1 image00400000!CompoundStatement::ctfeCompile+0x60 [C:\dmd-git\dmd2\src\dmd\src\interpret.c @ 378] 0018b600 0045fa11 image00400000!FuncDeclaration::ctfeCompile+0x1cc [C:\dmd-git\dmd2\src\dmd\src\interpret.c @ 677] 0018b6d0 00469053 image00400000!FuncDeclaration::interpret+0x6f [C:\dmd-git\dmd2\src\dmd\src\interpret.c @ 785] 0018b738 0045f713 image00400000!CallExp::interpret+0x764 [C:\dmd-git\dmd2\src\dmd\src\interpret.c @ 4743] 0018b788 004761ab image00400000!Expression::ctfeInterpret+0x6d [C:\dmd-git\dmd2\src\dmd\src\interpret.c @ 696] 0018b848 004766a0 image00400000!CompileStatement::flatten+0x4d [C:\dmd-git\dmd2\src\dmd\src\statement.c @ 511] 0018ba10 00498958 image00400000!CompoundStatement::semantic+0x7e [C:\dmd-git\dmd2\src\dmd\src\statement.c @ 616] 0018c1d8 00492674 image00400000!FuncDeclaration::semantic3+0x13ba [C:\dmd-git\dmd2\src\dmd\src\func.c @ 1278] 0018c210 0048fd0d image00400000!TemplateInstance::semantic3+0xf0 [C:\dmd-git\dmd2\src\dmd\src\template.c @ 6946] 0018c248 004907c6 image00400000!TemplateInstance::trySemantic3+0xc4 [C:\dmd-git\dmd2\src\dmd\src\template.c @ 5336] 0018c360 0048a23c image00400000!TemplateInstance::semantic+0xaa3 [C:\dmd-git\dmd2\src\dmd\src\template.c @ 5755] 0018c3e0 0049c6bf image00400000!functionResolve+0x17b [C:\dmd-git\dmd2\src\dmd\src\template.c @ 2555] 0018c528 0044be36 image00400000!resolveFuncCall+0x80 [C:\dmd-git\dmd2\src\dmd\src\func.c @ 2725] 0018ca44 00475e7d image00400000!CallExp::semantic+0x1f6d [C:\dmd-git\dmd2\src\dmd\src\expression.c @ 8999] 0018ca64 004766ef image00400000!ExpStatement::semantic+0x28 [C:\dmd-git\dmd2\src\dmd\src\statement.c @ 385] 0018cc2c 00498958 image00400000!CompoundStatement::semantic+0xcd [C:\dmd-git\dmd2\src\dmd\src\statement.c @ 624] 0018d3f4 00492674 image00400000!FuncDeclaration::semantic3+0x13ba [C:\dmd-git\dmd2\src\dmd\src\func.c @ 1278] 0018d42c 0048fd0d image00400000!TemplateInstance::semantic3+0xf0 [C:\dmd-git\dmd2\src\dmd\src\template.c @ 6946]
Comment #10 by andrej.mitrovich — 2013-09-17T11:18:31Z
(In reply to comment #9) > Ok I can reproduce it with the test-case from #c6. > > I've compiled with: > dmd -unittest test.d Actually I don't need to pass any flags to recreate the ICE. @hsteoh: you may want to try without the flags and rename the issue if it's unrelated to them.
Comment #11 by andrej.mitrovich — 2013-09-17T11:21:07Z
(In reply to comment #7) > and phobos git HEAD > (a54bc74277427133baf59185be36d7a5cb1de1a4). Note: You should rebase and try the newest Phobos. I've ran into a similar problem which is now fixed in in Phobos, see http://d.puremagic.com/issues/show_bug.cgi?id=11053
Comment #12 by hsteoh — 2013-09-17T11:27:28Z
I updated to the latest git HEAD (dmd, druntime, phobos), and the test case in comment #6 is still causing an ICE. You're right, though, that it doesn't seem to need the compile flags anymore (the initial test case did). I'll update the bug description.
Comment #13 by hsteoh — 2013-09-17T11:30:20Z
OK, confirmed that the original case (import std.traits) no longer fails with latest Phobos. The test case in comment #6 continues to generate the ICE.
Comment #14 by k.hara.pg — 2013-09-17T23:29:45Z
Comment #15 by github-bugzilla — 2013-09-19T07:08:12Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9ee91f6d31c8333fe7bafee3b49d8a3773146946 fix Issue 11054 - ICE: interpret.c:357: virtual void Statement::ctfeCompile(CompiledCtfeFunction*): Assertion `0' failed. https://github.com/D-Programming-Language/dmd/commit/e80b9cfaedfa0c59f27ede4e79c38be6245f3d0d Merge pull request #2569 from 9rnsr/fix11054 Issue 11054 - ICE: interpret.c:357: virtual void Statement::ctfeCompile(CompiledCtfeFunction*): Assertion `0' failed.