From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 516093858D32; Mon, 19 Feb 2024 17:49:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 516093858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708364965; bh=82a5QLZeqsmmqeLoxiISauec8CDux/PNQzmhELWZLXA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pz9NrSMOZISXWRWGBoAKKEM7tpOE7W8bjsme5ULc0cLIaCNMcKK2eIyVQgv0TZy5w jC0OPYisl5nwW06tHqVD2GMh3cd6672CsHY8MBoMIRaWnIbqzAkbc2JyDUVcddjZwe DiAQEGJ9ATiICcCOYfXETUaF/kXJmICaQPE6dlV0= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113976] [11/12/13/14 Regression] explicit instantiation of const variable template following implicit instantiation is assembled in .rodata instead of .bss since r8-2857-g2ec399d8a6c9c2 Date: Mon, 19 Feb 2024 17:49:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.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.5 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=3D113976 --- Comment #9 from Jakub Jelinek --- Note, adjusted testcase: struct S { int a, b; }; int foo () { return 42; } template const S a =3D { 42, foo () }; const S *b =3D &a <0>; template const S c =3D { 42, foo () }; template const S c <0>; template const S d =3D { 42, foo () }; const S *e =3D &d <0>; template const S d <0>; template const S f =3D { 42, foo () }; template const S f <0>; const S *g =3D &f <0>; int main () {} started crashing with r6-1525-g350562a75dfb4ac658adf620665871eb47166652 (before that commit it failed to link). When there is partly constant and partly dynamic initializer, we were never considering putting it into .bss section.=