]> gcc.gnu.org Git - gcc.git/commitdiff
[libstdc++] [testsuite] disable SRA for compare_exchange_padding
authorAlexandre Oliva <oliva@adacore.com>
Thu, 18 Apr 2024 11:00:59 +0000 (08:00 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Thu, 18 Apr 2024 11:03:56 +0000 (08:03 -0300)
On arm-vx7r2, the uses of as.load() as initializer get SRAed, so the
padding bits in the tests are not what we might expect from full-word
struct copies.

I tried adding a function to perform bitwise copying, but even taking
the as.load() argument by const&, we'd still construct a temporary
with SRAed field-wise copying.  Unable to find another way to ensure
we wouldn't get a temporary, I went for disabling SRA.

for  libstdc++-v3/ChangeLog

* testsuite/29_atomics/atomic/compare_exchange_padding.cc:
Disable SRA.

libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc

index 2f18d426e7f7eb384b5d495d9352baa54e727f48..a6081968ca86986555405844d683801e00fe832e 100644 (file)
@@ -1,6 +1,7 @@
 // { dg-do run { target c++20 } }
 // { dg-require-atomic-cmpxchg-word "" }
 // { dg-add-options libatomic }
+// { dg-additional-options "-fno-tree-sra" }
 
 #include <atomic>
 #include <cstring>
@@ -26,10 +27,10 @@ main ()
   s.s = 42;
 
   std::atomic<S> as{ s };
-  auto ts = as.load();
+  auto ts = as.load(); // SRA might prevent copying of padding bits here.
   VERIFY( !compare_struct(s, ts) ); // padding cleared on construction
   as.exchange(s);
-  auto es = as.load();
+  auto es = as.load(); // SRA might prevent copying of padding bits here.
   VERIFY( compare_struct(ts, es) ); // padding cleared on exchange
 
   S n;
This page took 0.057264 seconds and 5 git commands to generate.