dmd
dmd copied to clipboard
Fix issue 21893 - Fix `std.atomic.atomicStore` infinitely and recursively calling itself
Implements the change proposal in bug #21893, where std.atomic.atomicStore would infinitely and recursively call itself out of a vaguely-referenced function [which the compiler interpreted as calling itself].
Thanks for your pull request and interest in making D better, @avaxar! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:
- My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
- My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
- I have provided a detailed rationale explaining my changes
- New or modified functions have Ddoc comments (with
Params:andReturns:)
Please see CONTRIBUTING.md for more information.
If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.
Bugzilla references
Your PR doesn't reference any Bugzilla issue.
If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️
- In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example,
Fix Bugzilla Issue 12345orFix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "stable + dmd#15973"
Can you add a test for this?
Briefly reading up the issue, I think you're missing some more places where this recursion could occur?
_D4core6atomic__T11atomicStoreVEQBeQBc11MemoryOrderi5TiTiZQBpFNaNbNiNeKiiZv:
push RBP
mov RBP,RSP
sub RSP,020h
mov -010h[RBP],EDI
mov -8[RBP],RSI
mov EAX,-010h[RBP]
mov -018h[RBP],EAX
mov RSI,-8[RBP]
mov EDI,EAX
call _D4core8internal6atomic__T11atomicStoreVEQBnQBc11MemoryOrderi5TiZQBnFNaNbNiNePiiZv@PLT32
leave
is it even true?
The issue might be better off being fixed from LDC's side, as the issue is LDC-specific. It may have to do with LDC dereferencing the function overload calls inconsistently with DMD and GDC. So, I've forwarded the issue to ldc-developers/ldc#4701 instead.