From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B99BE385843B; Wed, 22 Sep 2021 07:39:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B99BE385843B From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/92981] static anonymous union does not work Date: Wed, 22 Sep 2021 07:39:49 +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: 10.0 X-Bugzilla-Keywords: ice-on-valid-code, link-failure X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: component short_desc keywords 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: Wed, 22 Sep 2021 07:39:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D92981 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Component|ipa |c++ Summary|ICE in |static anonymous union does |get_partitioning_class, at |not work |symtab.c:1966 | Keywords| |link-failure --- Comment #3 from Andrew Pinski --- I don't know if this is a front-end issue or a middle-end issue. The problem is unrelated to LTO really. Take: static union { int yz; int t; }; struct ra { static int &dy; }; int &ra::dy =3D (yz); bool bm () { return ra::dy =3D=3D yz; } int main(void) { return !bm(); } -------- CUT ----- With just -g0, we get a link failure: /opt/compiler-explorer/gcc-trunk-20210922/bin/../lib/gcc/x86_64-linux-gnu/1= 2.0.0/../../../../x86_64-linux-gnu/bin/ld: /tmp/ccBdpNQh.o:(.rodata+0x0): undefined reference to `yz' 4.1.2 produced some interesting assembly too: .local yz .comm yz,4,4 .local yz .comm yz,4,4=