[Issue 17821] atomicStore is buggy when target is larger than source

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 10 19:36:18 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17821

johanengelen at weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johanengelen at weka.io

--- Comment #1 from johanengelen at weka.io ---
The bad codegen bug is LDC specific. DMD errors upon the
atomicStore!(ulong,int) call ("core/atomic.d(1185): Error: bad type/size of
operands 'mov'").

Test cases:
```
    {
        shared ulong x = 0x1234_5678_8765_4321;
        atomicStore(x, 0);
        assert(x == 0);
    }
    {
        struct S
        {
            ulong x;
            alias x this;
        }

        shared S s;
        s = 0x1234_5678_8765_4321;
        atomicStore(s, 0);
        assert(s.x == 0);
    }
```

LDC fix: https://github.com/ldc-developers/druntime/pull/102

I am assuming that we want to preserve the current atomicStore interface, that
says it can be called with all types for which `val = newval` is valid.

--


More information about the Digitalmars-d-bugs mailing list