Bug 20629 – atomicStore does not compile for struct using -m64
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-03T10:51:27Z
Last change time
2020-03-03T12:22:46Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2020-03-03T10:51:27Z
The following code fails to compile with -m64 but passes with -m32:
atomics.d:
-------------------------------------
import core.atomic : atomicStore;
void main()
{
static struct Struct
{
uint a, b;
}
shared Struct s1 = Struct(1, 2);
atomicStore(s1, Struct(3, 4));
assert(cast(uint) s1.a == 3);
assert(cast(uint) s1.b == 4);
}
-------------------------------------
Compiler output:
-------------------------------------
core\internal\atomic.d(231): Error: template core.internal.atomic.atomicExchange cannot deduce function from argument types !(cast(MemoryOrder)5, false)(Struct*, Struct), candidates are:
core\internal\atomic.d(289): atomicExchange(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value)
with order = order,
result = false,
T = Struct
must satisfy one of the following constraints:
is(T : ulong)
is(T == class)
is(T == interface)
is(T U : U*)
core\atomic.d(127): Error: template instance core.internal.atomic.atomicStore!(cast(MemoryOrder)5, Struct) error instantiating
core\atomic.d(142): instantiated from here: atomicStore!(cast(MemoryOrder)5, Struct, Struct)
.\atomics.d(12): instantiated from here: atomicStore!(cast(MemoryOrder)5, Struct, Struct)
-------------------------------------
Reduced from https://forum.dlang.org/post/[email protected].
Comment #1 by dlang-bot — 2020-03-03T10:57:57Z
@MoonlightSentinel created dlang/druntime pull request #2971 "Fix Issue 20629 - atomicStore does not compile for struct using -m64" fixing this issue:
- Fix Issue 20629 - atomicStore does not compile for struct using -m64
https://github.com/dlang/druntime/pull/2971
Comment #2 by dlang-bot — 2020-03-03T12:22:46Z
dlang/druntime pull request #2971 "Fix Issue 20629 - atomicStore does not compile for struct using -m64" was merged into stable:
- 963f2cd1b6dcae56b9684603b5987f6fce17b3cf by MoonlightSentinel:
Fix Issue 20629 - atomicStore does not compile for struct using -m64
https://github.com/dlang/druntime/pull/2971