Bug 17352 – [REG 2.075a] Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2017-04-26T10:11:58Z
Last change time
2020-03-21T03:56:41Z
Assigned to
No Owner
Creator
Ketmar Dark

Comments

Comment #0 by ketmar — 2017-04-26T10:11:58Z
=== bug.d === void foo () {} void foo () {} void main () {} dmd bug.d Internal error: ddmd/backend/elfobj.c 1739 introduced around commit a48acfedcc3d011e4050bb3b37b51866698daa05 (use linkonce for Elf code COMDATs)
Comment #1 by ketmar — 2017-04-26T12:58:16Z
some details regarding the bug: previously, dmd happily creates .o file, and then linker complains about duplicate definition. and now, i have no way to know *what* symbol was defined multiple times. so this is not about "compiler doesn't check for two `foo()`s", it's about compiler ICEing now, and i have no way to know which symbol i redefined.
Comment #2 by b2.temp — 2017-04-26T13:05:03Z
x86-64 seems to be affected too but in a different way. The example provided previously compiles and links, instead of complaining about double definition.
Comment #3 by code — 2017-04-28T09:59:31Z
That goes on me I think, you've just found another way to emit 2 different functions with identical mangling. https://github.com/dlang/dmd/pull/6719, fix for Issue 17339 This should be an error in the frontend already, b/c the 2 foos aren't overrideable.
Comment #4 by ketmar — 2017-04-28T10:18:19Z
yeah. but the frontend will check for conflicting overloads only when `foo()` will be called. i guess this was done to gain some compilation speed by not checking each symbol against other symbols (O(n^2), i think). but this can be done differently, by using a hash table of all emited mangled names. this should be amortized O(n), and virtually painless. i mean, yes, the frontend should check for conflicting overloads even if they weren't called anywhere.
Comment #5 by code — 2017-05-31T23:10:37Z
(In reply to Ketmar Dark from comment #4) > i mean, yes, the frontend should check for conflicting overloads even if > they weren't called anywhere. Could be easily checked in overloadInsert et.al.
Comment #6 by code — 2017-06-29T01:25:31Z
cat > bug.d << CODE void bug(Args...)() { } void test(bool coin) { if (coin) { string foobar; bug!foobar(); } else { string foobar; bug!foobar(); } } CODE ---- dmd -c bug.d ---- Internal error: ddmd/backend/elfobj.c 1739 ---- This is a real instance of this bug caused by ambiguous mangling of local variables (see issue 14831). Interestingly enough `void bug(alias var)()` only outputs a single template instance :o.
Comment #7 by github-bugzilla — 2017-07-01T21:07:45Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/76affab78fec0c9acb0253d9672c5c0bdf843dd4 fix Issue 17352 - Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition https://github.com/dlang/dmd/commit/3440f186b246f76c1dba53c0d67e01e00dea633c Merge pull request #6955 from MartinNowak/fix17352 fix Issue 17352 - Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition
Comment #8 by github-bugzilla — 2017-07-05T19:09:54Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/76affab78fec0c9acb0253d9672c5c0bdf843dd4 fix Issue 17352 - Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition https://github.com/dlang/dmd/commit/3440f186b246f76c1dba53c0d67e01e00dea633c Merge pull request #6955 from MartinNowak/fix17352
Comment #9 by github-bugzilla — 2017-08-07T13:17:04Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/76affab78fec0c9acb0253d9672c5c0bdf843dd4 fix Issue 17352 - Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition https://github.com/dlang/dmd/commit/3440f186b246f76c1dba53c0d67e01e00dea633c Merge pull request #6955 from MartinNowak/fix17352