diff options
| author | Eli Friedman <efriedma@quicinc.com> | 2019-07-23 21:51:26 +0000 |
|---|---|---|
| committer | Eli Friedman <efriedma@quicinc.com> | 2019-07-23 21:51:26 +0000 |
| commit | c69273fa10720d6053630f21edc7e0d91847068e (patch) | |
| tree | 4bff64f19886f3024cad7521e9e97bb330430344 | |
| parent | a2fae1e3e99119d2701c855b71991c80648376fa (diff) | |
| download | bcm5719-llvm-c69273fa10720d6053630f21edc7e0d91847068e.tar.gz bcm5719-llvm-c69273fa10720d6053630f21edc7e0d91847068e.zip | |
[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
| -rw-r--r-- | llvm/docs/Atomics.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/docs/Atomics.rst b/llvm/docs/Atomics.rst index 450b5b36f63..60d7090790f 100644 --- a/llvm/docs/Atomics.rst +++ b/llvm/docs/Atomics.rst @@ -87,8 +87,10 @@ The following is equivalent in non-concurrent situations: 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. |

