https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81847
--- Comment #4 from Valentine <v at vsamko dot com> --- Created attachment 42002 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42002&action=edit code to reproduce ICE I reduced (thanks to suggestions above and CReduce) this to the attached example. g++ -w -flto -O3 -c gccbug.ii -o gccbug.ii.o g++ -flto -O3 -Wl,-r gccbug.ii.o -o gccbug.ii.merged.o -nostdlib -Wl,-r -flto-partition=one Second command crashes with lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:203 0x1317e97 add_symbol_to_partition_1 ../../gcc-7.1.0/gcc/lto/lto-partition.c:203 0x1317723 add_references_to_partition ../../gcc-7.1.0/gcc/lto/lto-partition.c:93 0x1317b8e add_symbol_to_partition_1 ../../gcc-7.1.0/gcc/lto/lto-partition.c:176 0x1317723 add_references_to_partition ../../gcc-7.1.0/gcc/lto/lto-partition.c:93 0x1317b8e add_symbol_to_partition_1 ../../gcc-7.1.0/gcc/lto/lto-partition.c:176 0x1317cab add_symbol_to_partition_1 ../../gcc-7.1.0/gcc/lto/lto-partition.c:163 0x1318e63 lto_balanced_map(int, int) ../../gcc-7.1.0/gcc/lto/lto-partition.c:550 0x1312b8d do_whole_program_analysis ../../gcc-7.1.0/gcc/lto/lto.c:3123 0x1312b8d lto_main() ../../gcc-7.1.0/gcc/lto/lto.c:3320 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.