D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7528 - The core.atomic module does not have implementations when compiling with -D.
Summary: The core.atomic module does not have implementations when compiling with -D.
Status: RESOLVED DUPLICATE of issue 5930
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 17:25 UTC by Kapps
Modified: 2012-02-23 01:07 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kapps 2012-02-16 17:25:43 UTC
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".
Comment 1 Kapps 2012-02-23 01:07:08 UTC
Looks like this is a duplicate of 5930, which didn't appear in my search for atomic.

Worth keeping in mind that this does cause incorrect results to be generated without warning when using atomic operations.

*** This issue has been marked as a duplicate of issue 5930 ***