================
Comment at: lib/CodeGen/CGAtomic.cpp:234
@@ +233,3 @@
+    // Update the memory at Expected with Old's value.
+    llvm::StoreInst *StoreExpected = CGF.Builder.CreateStore(Old, Val1);
+    StoreExpected->setAlignment(Align);
----------------
This is still not correct, as far as I can see.

According to the C++ standard, the value at `Val1` is replaced as part of the 
atomic operation of `atomic_compare_exchange_{weak|strong}{_explicit}`, and 
that update has the memory order given by the second memory order argument to 
the function.

The first half of this requirement seems highly problematic, and is probably a 
bug in the standard. The second half of this requirement seems to require that 
`Val1` is updated by an atomic store, using the 'failure' ordering for the 
atomic compare exchange operation.


http://llvm-reviews.chandlerc.com/D2922
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to