Summary: cas doesn't work when used in code compiled with -D
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime

--- Comment #0 from Jose Garcia <> 2011-05-05 12:03:54 PDT ---
$ cat cas_test.d
import core.atomic;
import std.exception;
import std.stdio;

   shared bool init = false;
writefln("init = %s", init);
   enforce(cas(&init, false, true));
writefln("init = %s", init);

void main() {}

$ dmd -unittest cas_test.d && ./cas_test
init = false
init = true
$ dmd -unittest -D cas_test.d && ./cas_test
init = false
object.Exception@cas_test.d(9): Enforcement failed
./cas_test(_D3std9exception7bailOutFAyaixAaZv+0x5b) [0x80a0dcb]
./cas_test(_D8cas_test11__unittest1FZv+0x39) [0x80954dd]
./cas_test(_D8cas_test9__modtestFZv+0x8) [0x80987bc]
./cas_test(runModuleUnitTests+0x87) [0x80a3d37]
./cas_test(_D2rt6dmain24mainUiPPaZi6runAllMFZv+0x20) [0x809b718]
./cas_test(_D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv+0x20) [0x809b678]
./cas_test(main+0x94) [0x809b624]
/lib/i386-linux-gnu/ [0x126e37]
./cas_test() [0x80953f1]

Does this have to do with core/atomic.d having version(D_Doc) bool
cas(...)(...) {return false; }  ?

The work around is not to use object files compiled with the -D flag!

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to