Hi!

The https://wg21.link/P2414R12 paper says that atomic operations on
pointers and reads/stores from/to volatile pointers behave as if
there is an intermediate cast to uintptr_t.
I believe GCC implements it like that since forever.
__sync_*/__atomic_* type-generic builtins if they are lowered to the
particular byte size builtin result in casts to uintptr_t and back
and the changed memory itself is treated as volatile modification,
so in GIMPLE no optimizations that would optimize say points-to
through atomics are possible, I believe we treat it as a pointer escaping
to global state and pointer coming from possibly global state afterwards.
When the atomic builtins are lowered, it is RTL with MEM/v and so treated
as volatile loads/stores/RMWs.
And volatile memory loads/stores/RMWs both in GENERIC, GIMPLE and RTL are
IMHO again treated as something escaping to global state and then something
being read from global state.

Do you agree we can close https://gcc.gnu.org/PR125835 and apply
following patch to wwwdocs?

diff --git a/htdocs/projects/cxx-status.html b/htdocs/projects/cxx-status.html
index 7acf6920..2fc1c6a6 100644
--- a/htdocs/projects/cxx-status.html
+++ b/htdocs/projects/cxx-status.html
@@ -146,7 +146,7 @@
     <tr>
       <td>Pointer lifetime-end zap proposed solutions</td>
       <td><a href="https://wg21.link/P2414R12";>P2414R12</a> (<a 
href="./cxx-dr-status.html">DR</a>)</td>
-      <td class="unsupported"> <a 
href="https://gcc.gnu.org/PR125835";>No</a></td>
+      <td class="supported"> Yes</td>
       <td></td>
     </tr>
     <tr>


        Jakub

Reply via email to