Hi, I compiled and linker a program -debug and the linker crashed. If I use -release flag , then the linker does not crash but then the program crashes. The program uses CTFE which may have to do with the crash.
Created attachment 515 [details] the picture of the error
The program uses a large compile-time generated function which seems to contribute to the problem.
The picture doesn't help at all. You need to provide a source file which will reproduce the error.
Created attachment 516 [details] one file that causes the problem this if compiled as dmd.exe -g compilerfailuretest.d will produce the error. Note download this file too:http://www.dsource.org/projects/scregexp/browser/trunk/scregexp.d That file is needed to place it in the same directory where compilerfailuretest.d is located.
(In reply to comment #4) > Created an attachment (id=516) [details] > one file that causes the problem > > this if compiled as > > dmd.exe -g compilerfailuretest.d > > will produce the error. > Note download this file > too:http://www.dsource.org/projects/scregexp/browser/trunk/scregexp.d > That file is needed to place it in the same directory where > compilerfailuretest.d is located. Thanks, I can reproduce the bug now.
it is possible to influence the occurance of the error by reducing the size of the statement ...auto perlreg = new screg!("/(?:(?<tok>\\#(?:.*?(?:"~eol~")|.*\\z))| (?<tok>\"(?:(?>\\\\\\\\|\\\\\"|.))*?\")| when parameter is smaller, the error does not occur.
Created attachment 517 [details] Somewhat reduced test case. This cuts it down to a single, self-contained file. (Funny -- I recognize my own code in there -- almost all the comments are mine!) There's plenty of work still to be done in cutting in right down.
Completely reduced test case shows it's due to nested functions. ---------- char[] foo(int n) { if (n == 0) return "void xxxx() {}"; return "void xxxx() { void yyyy() { }" ~ foo(n-1) ~ "}"; } mixin (foo(400));
Even smaller test case. Seems it happens with a depth around 512; it's probably exceeding the maximum symbol length. --- char[] foo(int n) { return "void abcde() {" ~ ( n>0 ? foo(n-1): "") ~ "}"; } mixin (foo(500));
The test case is crashing in dmd, not optlink. It's a stack overflow.
Hi, Should I repost my example?
(In reply to comment #10) > The test case is crashing in dmd, not optlink. It's a stack overflow. If you compile in debug mode, it crashes in DMD. If you compile in release mode, it crashes in OPTLINK.
Hi, What should I do so it gets fixed? I mean this bug. I reported this in November.
(In reply to comment #13) > Hi, > > What should I do so it gets fixed? I mean this bug. > I reported this in November. This is in the queue of critical but hard-to-fix and relatively obscure bugs. It is a few months away from being fixed. Note that when it gets 'fixed', it will generate a compile-time error rather than a link-time one. Bug 2315 is basically the same issue. I don't see any solution other than imposing a limit on CTFE recursion. So don't get the idea that the code will ever 'work'. It'll just fail more nicely.
A clear error message would suffice. How could I expect more? It would not be bad if the stack size for ctfre could be set? Is there a way to set the stack size for ctfe??
I cannot reproduce this problem. Please show exactly what commands are given to dmd and the linker.
(In reply to comment #17) > I cannot reproduce this problem. Please show exactly what commands are given to > dmd and the linker. dmd -g bug.d This was crashing with DMD2.048 and link 8.00.2. I have confirmed that link 8.00.6 fixed this. (And it's stayed fixed in 8.00.7).