From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0E2A73858C00; Fri, 2 Dec 2022 01:25:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E2A73858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669944318; bh=bz/FGbk8ZU6l/a6hdH76vNrtZeBLuVQU6kejb3UTTeg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R8grwURoxbC1hd7RQDlSba3vM1HAvfhwfo+n8dLHDJ3DS8+mp/WEa1zmTt14NiFMy QoqhV6QIsmwQXiBZ6MWx1nSEl5AbH75YV7+ZrQ0O7ycn9Q9p+avUekG7lnt2vGLo6z dPRIiYacdgdPX73xGZCfKjaRI7S/uTC3TNSCR3fQ= From: "lh_mouse at 126 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/66146] call_once not C++11-compliant on ppc64le Date: Fri, 02 Dec 2022 01:25:14 +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: 5.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: lh_mouse at 126 dot com 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: cc 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=3D66146 LIU Hao changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lh_mouse at 126 dot com --- Comment #53 from LIU Hao --- Why not implement `call_once` with `__cxa_guard_{acquire,release,abort}`? It's basically ``` template void call_once(once_flag& __once, _Callable&& __callable, _Args&&... __args) { int __r =3D ::__cxa_guard_acquire(&__once); if(__r =3D=3D 0) return; // passive __try { _INVOKE(forward<_Callable>(__callable), forward<_Args>(__args)...); } __catch(...) { ::__cxa_guard_abort(&__once); // exceptional __throw_exception_again; } ::__cxa_guard_release(&__once); // returning } ```=