wilzbach / tools-test

1 stars 0 forks source link

Optlink crash with more than 2048 modules generated and debug info #96

Closed wilzbach closed 7 years ago

wilzbach commented 10 years ago

Note: the issue was created automatically migrated from https://issues.dlang.org

Original bug ID: BZ#11559 From: yebblies <yebblies@gmail.com> Reported version: D2 CC: braddr@puremagic.com, bugzilla@digitalmars.com, mailnew4ster@gmail.com

wilzbach commented 10 years ago

Comment author: yebblies <yebblies@gmail.com>

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.

wilzbach commented 10 years ago

Comment author: Walter Bright <bugzilla@digitalmars.com>

Well, that was unexpected.

wilzbach commented 10 years ago

Comment author: yebblies <yebblies@gmail.com>

I forgot to add: This only happens with debug info enabled. -g or -gc make it crash.

wilzbach commented 10 years ago

Comment author: yebblies <yebblies@gmail.com>

This is the optlink bug, which is not a regression.

wilzbach commented 10 years ago

Comment author: Brad Roberts <braddr@puremagic.com>

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.

wilzbach commented 10 years ago

Comment author: Walter Bright <bugzilla@digitalmars.com>

Fixed in Optlink 8.00.14:

http://ftp.digitalmars.com/optlink.zip

wilzbach commented 10 years ago

Comment author: yebblies <yebblies@gmail.com>

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.

wilzbach commented 10 years ago

Comment author: Walter Bright <bugzilla@digitalmars.com>

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.

wilzbach commented 10 years ago

Comment author: Walter Bright <bugzilla@digitalmars.com>

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

wilzbach commented 10 years ago

Comment author: yebblies <yebblies@gmail.com>

Thanks, it works for me. We'll need to add a test case once the win32 autotester has been updated.

wilzbach commented 10 years ago

Comment author: Brad Roberts <braddr@puremagic.com>

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

wilzbach commented 10 years ago

Comment author: yebblies <yebblies@gmail.com>

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.

wilzbach commented 10 years ago

Comment author: github-bugzilla@puremagic.com

Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bcd35f71f122840fec5eec137b169cbb9057dc7c Fix Issue 11559 - Optlink crash with more than 2048 modules generated and debug info

https://github.com/D-Programming-Language/dmd/commit/72380cf1abe9ad1937f8ec4523953ca825c82151 Merge pull request BZ#3051 from yebblies/issue11559

Fix Issue 11559 - Optlink crash with more than 2048 modules generated and debug info

wilzbach commented 10 years ago

Comment author: github-bugzilla@puremagic.com

Commit pushed to 2.065 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/af1c13828ea3e66e7888e73a423dda185fd13c19 Merge pull request BZ#3051 from yebblies/issue11559

Fix Issue 11559 - Optlink crash with more than 2048 modules generated and debug info