[Issue 20359] New: core.atomic.cas throws with null as `ifThis`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 6 07:29:33 UTC 2019


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

          Issue ID: 20359
           Summary: core.atomic.cas throws with null as `ifThis`
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: johnch_atms at hotmail.com

The following code produces an access violation in the 2.089.0 release:

import core.atomic;
void main() {
  Object a, b = new Object;
  cas(&a, null, b);
}

If you cast everything to shared - cas(cast(shared)&a, cast(shared)null,
cast(shared)b) - it works as expected. Also if you pass an instantiated object
to the `ifThis` argument, it will also work correctly.

--


More information about the Digitalmars-d-bugs mailing list