From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F0493854158; Wed, 24 Aug 2022 12:28:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F0493854158 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661344120; bh=2Y0WKaYSCAMN/J6QpnCIQMoHgLyaqPhrpjrrsWJ4Vms=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nwlIv5TrNe4ZopnSQBj1glO6FIBYhknaQtWmv7vzSROzR4d4eWHNLwnzfXTbhcRUd ue3JeWMU0Lg6X6xKw0d8DP2lp9F3sNewWlCTxmIbCjieB48pzhfcQG8UeMTFqR2KI1 oeCYoqyfp3Kg9OXpFRIK9FKLXh3cbUkUAiciYCDM= From: "malat at debian dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103629] [11/12/13 Regression] wrong-code when mixing mutex with visibility=hidden Date: Wed, 24 Aug 2022 12:28:40 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: malat at debian dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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=3D103629 --- Comment #25 from Mathieu Malaterre --- Looks like there is an easy fix (work-around?): % cat Tree.h #pragma once #include #include class #ifdef VIS __attribute__((visibility("default"))) #endif Tree { public: static const std::string treeType() { static std::once_flag once; std::call_once(once, []() { std::printf("%p\n", &sTreeTypeName); sTreeTypeName.reset(new std::string()); }); std::printf("%p\n", &sTreeTypeName); if (!sTreeTypeName) throw "uhoh"; return *sTreeTypeName; } private: static std::unique_ptr sTreeTypeName; }; std::unique_ptr Tree::sTreeTypeName;=