[Issue 7528] New: The core.atomic module does not have implementations when compiling with -D.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 16 17:25:46 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7528

           Summary: The core.atomic module does not have implementations
                    when compiling with -D.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: opantm+spam at gmail.com


--- Comment #0 from Kapps <opantm+spam at gmail.com> 2012-02-16 17:25:43 PST ---
Most methods in core.atomic are versioned out with a stub method replacing them
when generating documentation. If you attempt to use something like atomicOp
for example, it will still compile but do nothing and always return T.init
(leading to quite a bit of confusion). If you try to use cas, you get a symbol
undefined, as the actual implementation is excluded when version(D_Doc) is set.

Test case:

module Test;
import std.stdio;
import core.atomic;

void main() {    
    int* a = new int();
    *a = 2;
    int* b = new int();
    *b = 1;    
    bool Result = cas(cast(shared)&a, cast(shared)a, cast(shared)b);    
    writeln(Result, ": ", *a, ", ", *b);
}

Compile with 'dmd test.d' and it runs and prints "true: 1, 1". Compile with
'dmd test.d -D' and it will fail to link with "Error 42: Symbol Undefined
_D4core6atomic20__T3casTPOiTPOiTPOiZ3casFPOPiOxPiOPiZb".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list