From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 1D8E3384AB48; Thu, 18 Apr 2024 11:14:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D8E3384AB48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713438891; bh=1s3kka1m4kldaOIon78utzRVYw/fuvFbN0hYW3bIG1k=; h=From:To:Subject:Date:From; b=Inrh+6fd9AXq8EpilWVfIFpcnNa0+uKWsWiOI4qCaRaQbSqwu4HrFPHEAmag+z1JM +I6LXi05EI4YaqQvhZPiuuyfw7ZqhCk/IApgfVMPNE6vZGm7B5sab7KWUNH2FB1xes TACTBARtgysKfg6YIO1ZCwoyOajIIje8iwWsnfYc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-10017] [libstdc++] [testsuite] disable SRA for compare_exchange_padding X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/heads/master X-Git-Oldrev: 5b178179e85ace01a97def40531e915c180aaeca X-Git-Newrev: dcf0bd14cda706be8d0c18963812beefca51df39 Message-Id: <20240418111451.1D8E3384AB48@sourceware.org> Date: Thu, 18 Apr 2024 11:14:51 +0000 (GMT) List-Id: https://gcc.gnu.org/g:dcf0bd14cda706be8d0c18963812beefca51df39 commit r14-10017-gdcf0bd14cda706be8d0c18963812beefca51df39 Author: Alexandre Oliva Date: Thu Apr 18 08:00:59 2024 -0300 [libstdc++] [testsuite] disable SRA for compare_exchange_padding 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. Diff: --- libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc index 2f18d426e7f..a6081968ca8 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc @@ -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 #include @@ -26,10 +27,10 @@ main () s.s = 42; std::atomic 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;