From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id A74D03853839 for ; Mon, 31 Oct 2022 15:34:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A74D03853839 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42b.google.com with SMTP id z14so16490899wrn.7 for ; Mon, 31 Oct 2022 08:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5WVWHbvst8j9hHl+TDvobXo8aq9sA9Z0FciRWTOpx1Y=; b=VwbXdWaAVztbj9heLqOH0cj2gfQQppkFrlpJiKDQKizBdI59CToa7DOAPeua5E7oZk z3wy32ZBzm2yElE+bgoVzGM+m3FsAb1UK9sYbFnD/qg4D29IMmHk/kiqEWZBnUVGoGm4 KVKT3MPT4TaJP+mk1lfc/hI59CWTM6nH+zkuax4RiOKY3HkC2rTRJtX9prWSgT3vKbJ3 uqyJxp417xNAo/vF6Ou80BthCmRIPJqma8I8w9tm07R+lRktmUbmeThqlELfOhHSdwFN vK9hDANGqcydelptJRvPqt/Il6h9BaWJ6EuWuHYndf+g9S75S1JFVKBlyC2RoFfKuEAA 6oEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5WVWHbvst8j9hHl+TDvobXo8aq9sA9Z0FciRWTOpx1Y=; b=BbkmT3Yj0LvRzg4ULbkE2QEyhnEizV1dlcK2oQGKBEzUd1sUKJozuuMPKL0SI2ZSmK InsPMzZose16HYO7sxSSbcWaJQzT82JmpahBbsobk65iMSXXwE9y0hDZQ16sDgFq/JMV g/nWKL6K/zPA5wsaO8K3kQVJECHVuPdEjH5+A0CXOc8xeFIbRtzxcDXO3i+nYseOK6i2 sfL/MAIONehIyusANZiElwA3ZdKWu+lJ6ojczegVXthbLqxUq4FDRYpTb9oirLIalwZv 2I3YZx3TiVxKI6v3CkgkYbBW+PKwgYSBkIlm2xdxo93BdiP9qq0NuW20y7nilp7iPHA/ Ep3Q== X-Gm-Message-State: ACrzQf1cm1HTYedz/3TtSG7JM9XDXaKrya6L8//Id+qxhPcJiJ69yog4 RpX0WzNYSZl4W5pbC7cM6vVt4g== X-Google-Smtp-Source: AMsMyM5rF1wIwfP9ZBT/5c+mVHOMRnn5JePHGW5znXSeeO+MlR33WFb3ylGXM6bYG1TbZ34EWfr2Vg== X-Received: by 2002:a5d:6147:0:b0:236:aa4:6eca with SMTP id y7-20020a5d6147000000b002360aa46ecamr8628852wrt.318.1667230469478; Mon, 31 Oct 2022 08:34:29 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id co4-20020a0560000a0400b002238ea5750csm9186131wrb.72.2022.10.31.08.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 08:34:28 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed] libstdc++: Fix compare_exchange_padding.cc test for std::atomic_ref Date: Mon, 31 Oct 2022 16:34:27 +0100 Message-ID: <5772422.MhkbZ0Pkbq@fomalhaut> In-Reply-To: <20220916202127.579816-1-jwakely@redhat.com> References: <20220916202127.579816-1-jwakely@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > The test was only failing for me with -m32 (and not -m64), so I didn't > notice until now. That probably means we should make the test fail more > reliably if the padding isn't being cleared. The tests fail randomly for me on SPARC64/Linux: FAIL: 29_atomics/atomic/compare_exchange_padding.cc execution test FAIL: 29_atomics/atomic_ref/compare_exchange_padding.cc execution test /home/ebotcazou/src/libstdc++-v3/testsuite/29_atomics/atomic_ref/ compare_exchange_padding.cc:34: int main(): Assertion 'compare_struct(ts, es)' failed. FAIL: 29_atomics/atomic_ref/compare_exchange_padding.cc execution test std::atomic as{ s }; auto ts = as.load(); VERIFY( !compare_struct(s, ts) ); // padding cleared on construction as.exchange(s); auto es = as.load(); VERIFY( compare_struct(ts, es) ); // padding cleared on exchange How is it supposed to pass exactly? AFAICS you have no control on the padding bits of ts or es and, indeed, at -O2 the loads are scalarized: __buf$c_81 = MEM[(struct S *)&__buf].c; __buf$s_59 = MEM[(struct S *)&__buf].s; __buf ={v} {CLOBBER(eol)}; ts.c = __buf$c_81; ts.s = __buf$s_59; [...] __buf$c_100 = MEM[(struct S *)&__buf].c; __buf$s_35 = MEM[(struct S *)&__buf].s; __buf ={v} {CLOBBER(eol)}; es.c = __buf$c_100; es.s = __buf$s_35; _66 = MEM [(char * {ref-all})&ts]; _101 = MEM [(char * {ref-all})&es]; if (_66 != _101) goto ; [0.04%] else goto ; [99.96%] so the result of the 4-byte comparison is random. -- Eric Botcazou