[llvm] r366855 - [docs] Clarify where the indirect UB due to write-write races comes from

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 14:51:26 PDT 2019


Author: efriedma
Date: Tue Jul 23 14:51:26 2019
New Revision: 366855

URL: http://llvm.org/viewvc/llvm-project?rev=366855&view=rev
Log:
[docs] Clarify where the indirect UB due to write-write races comes from

This is based on https://bugs.llvm.org/show_bug.cgi?id=42435#c3.

Patch by Ralf Jung.


Modified:
    llvm/trunk/docs/Atomics.rst

Modified: llvm/trunk/docs/Atomics.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Atomics.rst?rev=366855&r1=366854&r2=366855&view=diff
==============================================================================
--- llvm/trunk/docs/Atomics.rst (original)
+++ llvm/trunk/docs/Atomics.rst Tue Jul 23 14:51:26 2019
@@ -87,8 +87,10 @@ The following is equivalent in non-concu
 
 However, LLVM is not allowed to transform the former to the latter: it could
 indirectly introduce undefined behavior if another thread can access ``x`` at
-the same time. (This example is particularly of interest because before the
-concurrency model was implemented, LLVM would perform this transformation.)
+the same time. That thread would read `undef` instead of the value it was
+expecting, which can lead to undefined behavior down the line. (This example is
+particularly of interest because before the concurrency model was implemented,
+LLVM would perform this transformation.)
 
 Note that speculative loads are allowed; a load which is part of a race returns
 ``undef``, but does not have undefined behavior.




More information about the llvm-commits mailing list