https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122603
Bug ID: 122603
Summary: ICE in get_partitioning_class with
-flto-partition=cached
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
Working on a testcase. This happens only with -flto-partition=cached. balanced
is fine.
```
$ g++ -O3 -march=native -flto=jobserver -fno-semantic-interposition -g1 -pipe
-fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never
-frecord-gcc-switches -fdiagnostics-show-context=3 -Wa,-O2 -Wa,-mtune=znver2
-Warray-bounds --param=ggc-min-expand=120 -Wstrict-aliasing
-Wfree-nonheap-object -Wuninitialized -Wmaybe-uninitialized -Wreturn-type
-Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr -Warray-bounds
-Wstringop-overread -Wstringop-overflow -Wstringop-truncation -Wformat-overflow
-Wformat-truncation -Wrestrict -ggdb3
-flto-incremental=/var/tmp/portage/lto/dev-util/cvise -flto-partition=cache
-flto-compression-level=19 -Wformat -Werror=format-security -Wall -Wextra
-pedantic -Wno-unused-parameter -std=c++17 -fno-rtti -fno-strict-aliasing
-fvisibility-inlines-hidden -Wno-error=mismatched-new-delete
-Wno-error=maybe-uninitialized -Wno-error=class-memaccess
-Wno-error=non-template-friend -Wno-error=deprecated-declarations -O3
-march=native -flto=jobserver -fno-semantic-interposition -g1 -pipe
-fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never
-frecord-gcc-switches -fdiagnostics-show-context=3 -Wa,-O2 -Wa,-mtune=znver2
-Warray-bounds --param=ggc-min-expand=120 -Werror=lto-type-mismatch
-Werror=strict-aliasing -Werror=odr -Warray-bounds -Wstringop-overread
-Wstringop-overflow -Wstringop-truncation -Wformat-overflow -Wformat-truncation
-Wrestrict -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -flto=jobserver
-Wl,--defsym=__gentoo_check_ldflags__=0 -ggdb3
-flto-incremental=/var/tmp/portage/lto/dev-util/cvise -flto-partition=cache
-flto-compression-level=19 [...]
==960908== Invalid read of size 1
==960908== at 0x5E4F084: test<symtab_node> (cgraph.h:2259)
==960908== by 0x5E4F084: is_a<cgraph_node*, symtab_node> (is-a.h:232)
==960908== by 0x5E4F084: dyn_cast<cgraph_node*, symtab_node> (is-a.h:282)
==960908== by 0x5E4F084: symtab_node::get_partitioning_class()
(symtab.cc:2173)
==960908== by 0x525C478: split_partition_into_nodes (lto-partition.cc:551)
==960908== by 0x525C478: partition_over_target_split (lto-partition.cc:799)
==960908== by 0x525C478: partitioner_default::split_state(partition_set&,
unsigned long) (lto-partition.cc:993)
==960908== by 0x525BECA: split_list (lto-partition.cc:932)
==960908== by 0x525BECA: partitioner_default::split_state(partition_set&,
unsigned long) (lto-partition.cc:987)
==960908== by 0x525BC5C: apply (lto-partition.cc:900)
==960908== by 0x525BC5C: lto_cache_map(int, int) (lto-partition.cc:1059)
==960908== by 0x404D5D2: do_whole_program_analysis (lto.cc:563)
==960908== by 0x404D5D2: lto_main() [clone .cold] (lto.cc:675)
==960908== by 0x67EE616: compile_file() [clone .lto_priv.0] (toplev.cc:453)
==960908== by 0x67B495D: do_compile() [clone .lto_priv.0] (toplev.cc:2220)
==960908== by 0x679A933: toplev::main(int, char**) (toplev.cc:2383)
==960908== by 0x6799308: main (main.cc:39)
==960908== Address 0xc is not stack'd, malloc'd or (recently) free'd
==960908==
lto1: internal compiler error: Segmentation fault
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```