From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61FEB3858C50; Sat, 27 Apr 2024 00:38:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61FEB3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714178315; bh=7IXIEhbl1KoHFvRRmiaKqGS3+nOs/Uw0fZISZdb7phg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dqBRJWn/K3BeYgjuj5qbTF+AAlsPN9a7ZCjwlt4J5lsGXIvhBFuIYw4iVVf6NnqA3 xUq9FtSZwC9DKTAnDaVPvZVVwyxg6rPdKhQ0hgdPE9Dxx7HvR5jArAO9Ez/S8J7Wyk 64AE6bouT3okoEJcJ9MN8QqZQY2EjXJi/4Ov8Huw= From: "pdimov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114865] [13/14/15 Regression] std::atomic::compare_exchange_strong seems to hang under GCC 13 for C++11 Date: Sat, 27 Apr 2024 00:38:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pdimov at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114865 --- Comment #11 from Peter Dimov --- So, basically, C++14 and above initialize the padding of ``` std::atomic state{{ 0, 0x2222 }}; ``` in `main` to zero, which masks the problem in `generate`. (The problem in `generate` still exists because the assembly is identical - it just doesn't trigger because the padding is zero. If we manually poke something nonzero = into the padding, it would (ought to) still break.) Static variables work for the same reason - the padding is guaranteed zero.=