Thread overview
[Issue 17821] atomicStore is buggy when target is larger than source
Sep 10
Eyal
[Issue 17821] atomicStore compile error when target is larger than source
September 10
https://issues.dlang.org/show_bug.cgi?id=17821

Eyal <eyal@weka.io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eyal@weka.io, tomer@weka.io

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

Tomer Filiba (weka) <tomer@weka.io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry

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

johanengelen@weka.io changed:

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

--- Comment #1 from johanengelen@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.

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

--- Comment #2 from johanengelen@weka.io ---
Fixed in LDC 1.4.0.

The remaining issue is compilation error with DMD for:
```
import core.atomic;
shared ulong x;
atomicStore(x, 0);
```

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

johanengelen@weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|phobos                      |druntime
            Summary|atomicStore is buggy when   |atomicStore compile error
                   |target is larger than       |when target is larger than
                   |source                      |source

--