Bug 11559 – Optlink crash with more than 2048 modules generated and debug info
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
tools
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-19T22:30:00Z
Last change time
2017-01-10T01:46:34Z
Keywords
ice, Optlink, pull
Assigned to
nobody
Creator
yebblies
Comments
Comment #0 by yebblies — 2013-11-19T22:30:18Z
Due to https://github.com/D-Programming-Language/dmd/pull/2785 dmd now generates one module per mixin line.
string gen()
{
string m;
foreach(i; 0..2048)
m ~= "mixin(\"assert(0);\");\n";
return m;
}
void main()
{
mixin(gen());
}
Causes a dmd regression.
Comment #1 by bugzilla — 2013-11-20T21:09:32Z
Well, that was unexpected.
Comment #2 by yebblies — 2013-11-22T00:24:05Z
I forgot to add: This only happens with debug info enabled. -g or -gc make it crash.
Comment #3 by yebblies — 2013-11-24T16:37:55Z
This is the optlink bug, which is not a regression.
Comment #4 by braddr — 2013-11-25T18:05:32Z
Changing back to regression. It's not directly a regression of dmd, but the combination of a dmd change and an optlink limit results in code that built before not building now.
It's the same category of issues as any bug that causes the linker to reject a dmd generated object file.
How much did you bump it by? The original test case now works, but this fails:
string gen()
{
string m;
foreach(i; 0..4096)
m ~= "mixin(\"assert(0);\n\n\n\n\");\n";
return m;
}
void main()
{
mixin(gen());
}
I'm mixin'ing a string into each function in ddmd, so this isn't a synthetic test case.
Comment #7 by bugzilla — 2013-12-24T09:49:05Z
(In reply to comment #6)
> How much did you bump it by?
I didn't bump it at all. I changed the allocation scheme for that table to one that allocated the desired size, rather than allocating a 16K buffer and hoping it wouldn't overflow.
You're probably seeing an overflow from another table. I'll look into it.
Comment #8 by bugzilla — 2013-12-25T13:44:49Z
(In reply to comment #7)
> You're probably seeing an overflow from another table. I'll look into it.
I found that particular problem and uploaded a fix.
http://ftp.digitalmars.com/optlink.zip
Comment #9 by yebblies — 2013-12-25T19:19:48Z
Thanks, it works for me. We'll need to add a test case once the win32 autotester has been updated.
Comment #10 by braddr — 2013-12-30T18:02:47Z
The win32 auto-tester is updated with the new optlink. The unittest can be added now. A bit of communication is warranted about this fix, since as soon as the test is checked in, every developer who runs the tests will be hit by the bug.
I've uploaded the new optlink to:
http://downloads.dlang.org/other/optlink-8.00.14.zip
Comment #11 by yebblies — 2013-12-30T21:37:24Z
(In reply to comment #10)
> The win32 auto-tester is updated with the new optlink. The unittest can be
> added now. A bit of communication is warranted about this fix, since as soon
> as the test is checked in, every developer who runs the tests will be hit by
> the bug.
>
> I've uploaded the new optlink to:
>
> http://downloads.dlang.org/other/optlink-8.00.14.zip
I opened https://github.com/D-Programming-Language/dmd/pull/3051 to add the test case.
I named the test case test11559upgradeoptlink.d - it should be fairly obvious what needs doing when it fails.
Comment #12 by github-bugzilla — 2013-12-30T22:32:18Z