From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7C9583858C78; Fri, 4 Feb 2022 00:03:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C9583858C78 From: "rodgertq at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/102994] std::atomic::wait is not marked const Date: Fri, 04 Feb 2022 00:03:17 +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: 11.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: rodgertq at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rodgertq at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2022 00:03:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102994 --- Comment #7 from Thomas Rodgers --- (In reply to =C3=93scar Fuentes from comment #6) > (In reply to Jonathan Wakely from comment #5) > > (In reply to =C3=93scar Fuentes from comment #4) > > > The fix is wrong. It changes atomic_notify_one and atomic_notify_all = instead > > > of atomic<>::wait. > >=20 > > It changed both. > >=20 > > > So right now atomic<>::wait remains unfixed > >=20 > > Are you sure? >=20 > Sigh. Sorry. It would be nice if the commit message mentioned the change = to > atomic_notify_* and its motivation, though. >=20=20 > > > and atomic_notify_(one|all) arg > > > is wrongly marked as const. > >=20 > > This will be the subject of a library issue, potentially fixing the > > standard. The notify functions should be const too. >=20 > So IIUC you are applying modifications to libstdc++ that deviate from the > published standard expecting that the committee will accept those changes. > As a user, this is troublesome, because right now I need to special-case = gcc > version >11.2 and maybe version not accepted and is reverted. There is an ongoing discussion between myself and the SG1,LWG, and LEWG cha= irs (two of which were authors of p1135 which proposes atomic wait/notify) as to whether there is a wording issue with the standard. None of the three major standard library implementations require (as a matt= er of implementation detail) notify_one/notify_all to be non-const, and indeed= the early wording of p1135 had them marked const. Between r2 and r3 of p1135 th= is was changed, it'cites the minutes of an LEWG discussion as part of the chan= ge rationale, but the minutes of that discussion do not give the motivation for the change. One argument is that you would typically wait in a const context and notify= in a non-const context, but by that rationale, the constness of atomic_ref::no= tify is somewhat weird.=