Bug 18296 – [Reg2.078.1] invalid code with coverage and copy construction
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-01-24T21:35:48Z
Last change time
2018-02-27T22:44:51Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Martin Nowak
Comments
Comment #0 by code — 2018-01-24T21:35:48Z
cat > bug.d << CODE
alias AliasSeq(Args...) = Args;
struct Duration
{
this(long hnsecs)
{
_hnsecs = hnsecs;
}
long _hnsecs;
}
void main()
{
foreach(U; AliasSeq!(Duration, const Duration))
{
const Duration t = 42;
U u = t;
assert(t._hnsecs == u._hnsecs);
}
}
CODE
dmd -cov -run bug.d
Comment #1 by code — 2018-01-24T21:43:37Z
Only occurs with PIC enabled, guess this happens as a result of https://github.com/dlang/dmd/pull/7654 whereby coverage symbols no longer have local linkage.
Comment #4 by github-bugzilla — 2018-02-27T22:44:50Z
Commits pushed to master at https://github.com/dlang/dmdhttps://github.com/dlang/dmd/commit/0146d2be4298f15416a4f0bee08876934ed2200c
fix Issue 18296 - make __coverage a hidden symbol
- external linkage only for current DSO, but not across DSOs
- avoids GOT indirection on every access
- thus avoids codegen bugs related to those
- uses SCstatic with SFLhidden flag as the access is the same as for
static symbols, even though linkage is between SCglobal and SCstatic
In the long-run (and with more usage) a separate SChidden might be cleaner.
- no changes to OMF code as LPUBDEF isn't used
https://github.com/dlang/dmd/commit/eb2bf7713cd46d49a9ea75999188d84b410b45d5
Merge pull request #7772 from MartinNowak/fix18296
fix Issue 18296 - make __coverage a hidden symbol