https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92981
Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> --- 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 = (yz); bool bm () { return ra::dy == 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/12.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