Bug 17072 – [REG 2.073.0-b1] missing symbols with -inline

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2017-01-08T12:26:00Z
Last change time
2017-01-24T11:54:54Z
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2017-01-08T12:26:46Z
With dmd 2.073.0-beta1, this code import core.thread; void main() { Thread.sleep(dur!"msecs"(50)); } produces a link error: >dmd.exe test.d -m64 -inline test.obj : error LNK2019: unresolved external symbol _D4core4time8Duration46__T10opOpAssignVAyaa1_2dTS4core4time8DurationZ10opOpAssignMFNaNbNcNiNfxS4core4time8DurationZS4core4time8Duration referenced in function _Dmain This does not happen with dmd 2.072 or without -inline.
Comment #1 by code — 2017-01-15T17:58:10Z
There is a difference between the mangling of the symbol included in phobos64.lib and the one requested. phobos64.lib has: _D4core4time8Duration46__T10opOpAssignVAyaa1_2dTS4core4time8DurationZ10opOpAssignMFNaNbNcNiNjNfxS4core4time8DurationZS4core4time8Duration linker wants: _D4core4time8Duration46__T10opOpAssignVAyaa1_2dTS4core4time8DurationZ10opOpAssignMFNaNbNcNiNfxS4core4time8DurationZS4core4time8Duration ddemangle doesn't yet know Nj, it stands for FuncAttrReturn (https://dlang.org/spec/abi.html#FuncAttrReturn). So what we have here is likely a difference in return inference in different compilations, leading the test below to think that the template was already instantiated by druntime, therefor not emitting it itself, but the instantiation in druntime inferred a different STCreturn. It's only reproducible w/ -inline b/c that runs semantic3 on imported functions and templates. Happens because the released library is build with -dip25 which enables return inference and obviously creates ABI incompatibilities.
Comment #2 by bugzilla — 2017-01-16T02:29:00Z
(In reply to Rainer Schuetze from comment #0) > This does not happen with dmd 2.072 or without -inline. It does work if you throw -dip25. Still a regression, though.
Comment #3 by bugzilla — 2017-01-16T02:40:13Z
Comment #4 by github-bugzilla — 2017-01-17T00:08:52Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/575e6d130d10410e3845a9df1ee2f7e13e84cd9a fix Issue 17072 - [REG 2.073.0-b1] missing symbols with -inline https://github.com/dlang/dmd/commit/661be50c59cc83a9376776598ff63fb84b08bb55 Merge pull request #6452 from WalterBright/fix17072 fix Issue 17072 - [REG 2.073.0-b1] missing symbols with -inline
Comment #5 by github-bugzilla — 2017-01-18T13:53:00Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/575e6d130d10410e3845a9df1ee2f7e13e84cd9a fix Issue 17072 - [REG 2.073.0-b1] missing symbols with -inline https://github.com/dlang/dmd/commit/661be50c59cc83a9376776598ff63fb84b08bb55 Merge pull request #6452 from WalterBright/fix17072
Comment #6 by github-bugzilla — 2017-01-24T11:54:54Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/575e6d130d10410e3845a9df1ee2f7e13e84cd9a fix Issue 17072 - [REG 2.073.0-b1] missing symbols with -inline https://github.com/dlang/dmd/commit/661be50c59cc83a9376776598ff63fb84b08bb55 Merge pull request #6452 from WalterBright/fix17072