Skip to content

Commit c69273f

Browse files
committed
[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. llvm-svn: 366855
1 parent a2fae1e commit c69273f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/docs/Atomics.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ The following is equivalent in non-concurrent situations:
8787
8888
However, LLVM is not allowed to transform the former to the latter: it could
8989
indirectly introduce undefined behavior if another thread can access ``x`` at
90-
the same time. (This example is particularly of interest because before the
91-
concurrency model was implemented, LLVM would perform this transformation.)
90+
the same time. That thread would read `undef` instead of the value it was
91+
expecting, which can lead to undefined behavior down the line. (This example is
92+
particularly of interest because before the concurrency model was implemented,
93+
LLVM would perform this transformation.)
9294

9395
Note that speculative loads are allowed; a load which is part of a race returns
9496
``undef``, but does not have undefined behavior.

0 commit comments

Comments
 (0)