https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81847
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- Created attachment 42004 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42004&action=edit A bit smaller test-case Smaller test-cast which needs to add --param lto-min-partition=1. Problem is following, we create an isra clone and we'll put it into a comdat group: _Z11format_packIJiiN1a1b1fIcccEEEEvDpT_.isra.37/2088 (_Z11format_packIJiiN1a1b1fIcccEEEEvDpT_.isra.37) @0x2b2b65795b80 Type: function definition analyzed Visibility: prevailing_def_ironly comdat_group:_ZN3PigC5IiJiN1a1b1fIcccEEEEET_DpT0_ artificial Same comdat group as: _ZN3PigC2IiJiN1a1b1fIcccEEEEET_DpT0_/371 References: __gxx_personality_v0/1347 (addr) Referring: Read from file: gccbug.o Availability: local First run: 0 Function flags: local Called by: _ZN3PigC2IiJiN1a1b1fIcccEEEEET_DpT0_/371 (1.00 per call) Calls: _ZN1a1b1fIcccE2crEl/1473 _ZN1a5tupleIJiiNS_1b1fIcccEEEED1Ev/607 _ZN1a1b1fIcccE2crEl/1473 (0.37 per call) _ZN1a5tupleIJiiNS_1b1fIcccEEEED2Ev/2938 (inlined) (1.00 per call) _Z12format_tupleIN1a5tupleIJiiNS0_1b1fIcccEEEEELi3EEvT_NS0_1lIiXT0_EEE.isra.10/1803 (inlined) (1.00 per call) _ZN1a5tupleIJiiNS_1b1fIcccEEEEC2IJiiS3_ELj1EEEDpT_/798 (inlined) (1.00 per call) _ZN1a1b1fIcccE2coC1EPcNS_9allocatorIcEE/1471 (1.00 per call) (can throw external) _ZN1a1b1fIcccE2csEv/1470 (1.00 per call) (can throw external) Then we start partitioning and following symbols are put to a partition: add_symbol_to_partition: __base_ctor /371 Step 1: added _Z11format_packIJiiN1a1b1fIcccEEEEvDpT_.isra.37/2088, size 931, cost 3013/1012 best 3013/1012, step 1 the partition is finished and in a next partition: Symbol node __base_ctor /371 now used in multiple partitions and then we attempt to add again the isra clone and we fail. That triggers the assert. We have: 113 static bool 114 add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node) 115 { ... 124 /* non-duplicated aliases or tunks of a duplicated symbol needs to be output 125 just once. 126 127 Be lax about comdats; they may or may not be duplicated and we may 128 end up in need to duplicate keyed comdat because it has unkeyed alias. */ 129 if (c == SYMBOL_PARTITION && !DECL_COMDAT (node->decl) 130 && symbol_partitioned_p (node)) 131 return false; Shouldn't be this place somehow adjusted in order to handle symbols in comdat group that are actually not DECL_COMDATs? Honza?