Bug 6951 – dependency parameter (-deps) crashes dmd in release build

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-11-15T01:07:00Z
Last change time
2015-06-09T05:14:42Z
Keywords
ice
Assigned to
nobody
Creator
spam

Attachments

IDFilenameSummaryContent-TypeSize
1044main.dcode to crash dmdapplication/octet-stream5259
1053bug.zipexample code how to crash dmdapplication/octet-stream6251
1061main.dtestcase for dmd2057application/octet-stream958
1062main.dtestcase for dmd2057application/octet-stream609

Comments

Comment #0 by spam — 2011-11-15T01:07:22Z
Created attachment 1044 code to crash dmd try to build the attached main.d using this cmd line: dmd main.d -release -inline -O -noboundscheck -deps=main.obj.dep this crashes dmd in version 2.056. this is especially bad because visualD automatically attaches the -deps parameter to dmd when building a project.
Comment #1 by spam — 2011-11-15T01:08:44Z
and of course i know that it imports foo and i did not attach foo.d but thats because its not necessary to reproduce the crash...
Comment #2 by spam — 2011-11-15T01:26:33Z
The following code seems to cause a related issue, i dont know. building it with: dmd main.d -release -O -inline -noboundscheck -deps=main.dep gives: "Assertion failure: 'tdtypes.dim == ti->tdtypes.dim' on line 3928 in file 'template.c'" [CODE] module main; import std.stdio; struct Test { //int a; void foo() { // if(&this != null) // a = 2; } } void main() { Test* t = new Test(); t.foo(); t = null; t.foo(); } [/CODE]
Comment #3 by verylonglogin.reg — 2011-11-16T02:07:44Z
A bit reduced case (no -O needed, smaller user code file (but a lot of library code is still imported)) main.d: --- import std.math; --- Command line for dmd 2.056: dmd main.d -release -inline -noboundscheck -deps=main.dep
Comment #4 by yebblies — 2011-12-12T22:55:03Z
Can't reproduce with dmd 2.057 head. Is it still broken for you with the latest version?
Comment #5 by adrian — 2011-12-15T14:21:52Z
Created attachment 1053 example code how to crash dmd the crash seems only to happen if both switches -noboundscheck and -deps="bug.dep" are used. if you omit one of them the crash wont show. The command line I used is contained in the bug.bat I have included the module btree.d witch is not referenced by the code in main.d, but compiled with main.d on the same command line. Without the module in the command line I can't reproduce the crash. if you comment out the first writeln("Hello D-World!") in main() - no crash if you comment out the other two writeln(..) in main() - no crash the code in main.d is totally unrelated to the code in btree.d, but there must be something in btree.d which causes the crash.
Comment #6 by dlang-bugzilla — 2011-12-17T17:35:22Z
bug.bat runs without problem with v2.057 on my machine. Perhaps you can reduce a minimal test case using DustMite?
Comment #7 by spam — 2011-12-30T03:34:38Z
yeah with those given test cases i can't reproduce it either but with huge include folders that i add via -I parameter the -deps parameter still crashes
Comment #8 by spam — 2011-12-30T04:18:45Z
Created attachment 1061 testcase for dmd2057 so i found a small testcase to reproduce the crash in current dmd 2057. see new attachment
Comment #9 by spam — 2011-12-30T04:20:45Z
Created attachment 1062 testcase for dmd2057
Comment #10 by spam — 2011-12-30T04:30:43Z
ok smallest testcase so far: [CODE] module main; import std.stdio; struct BinaryHeap(T){ T[] m_data; public void insert(T _val){ m_data[$-1] = _val; if(m_data.length == 1) return; } public void opOpAssign(string s)(T _val){ if(s == "~") {insert(_val);} } public T front(){ assert(!isEmpty()); return m_data[0]; } public bool isEmpty() const{ return (m_data.length == 0); } } void main(string[] argv) { BinaryHeap!int foo; foo ~= 10; } [/CODE] dont forget to build with: dmd -inline -release -noboundscheck -deps=foo.dep main.d and just for kicks: while reducing the test case some unrelated changes made the crash become a choke up of "Out of Memory"
Comment #11 by clugdbug — 2012-04-03T00:51:54Z
Bug 7478 appears to be the same, and has a greatly reduced test case.
Comment #12 by clugdbug — 2012-05-15T21:39:08Z
The test case works now. *** This issue has been marked as a duplicate of issue 7478 ***