From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E07123858C52; Thu, 11 Apr 2024 11:10:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E07123858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712833856; bh=SFcIxBVKIdoPGmimNQlqb47OGIgGFp8SdDZvZy3BDKo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PrLx4BB5T1uxBaivZYxVte337WE01QR+fm2bWzSo8KnYFYsAhYalzXv2lFttPKnAQ YOQSX+s/9gQ6Oez+8xpk3/m410owFih38QyEohMT5V/GYu1FMKtsALeTg2f3J0KmcS K7CdsiRLGvnrCqEyztIu8DQsHCqG8IAavfydEUuM= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/89624] HLE acquire/release bits in std::memory_order don't work with -fshort-enums or -fstrict-enums Date: Thu, 11 Apr 2024 11:10:55 +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: 9.0 X-Bugzilla-Keywords: ABI X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D89624 --- Comment #5 from Jonathan Wakely --- I think we should just do this: --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline constexpr memory_order memory_order_acq_rel =3D memory_order::acq= _rel; inline constexpr memory_order memory_order_seq_cst =3D memory_order::seq= _cst; #else - typedef enum memory_order + enum memory_order : int { memory_order_relaxed, memory_order_consume, @@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION memory_order_release, memory_order_acq_rel, memory_order_seq_cst - } memory_order; + }; #endif /// @cond undocumented That ensures a consistent underlying type for C++17 down and C++20 up (and = gets rid of the redundant typedef). This will mean the type isn't affected by the -fshort-enums flag at all, which also happens to solve the static_assert failure in comment 0. This is an ABI change for the underlying type when using -fshort-enums, but that flag is already explicitly ABI-changing and not the default, so I care less about a change there.=