www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15751] New: atomicLoad doesn't return stable result if


          Issue ID: 15751
           Summary: atomicLoad doesn't return stable result if compiled
                    with -profile
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrey.zherikov gmail.com

atomicLoad() doesn't constantly return 0 in the following code if it's compiled
with -profile option:
import core.atomic;

int main()
    shared int s = 0;
    return atomicLoad(s);

Compiler: DMD32 D Compiler v2.070.2
Compile command: dmd test.d -oftest_p -profile
Test command:
    pass=0; fail=0;
    for i in $(seq 1 100);
        ./test_p.exe && pass=$((pass+1)) || fail=$((fail+1));
    echo pass=$pass fail=$fail
Test command output (example):
    pass=89 fail=11

Even adding "atomicStore(s, 0);" right before atomicLoad doesn't guarantee the
    pass=95 fail=5

Mar 03 2016