https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111111
Bug ID: 111111 Summary: omnetpp: ICEs with dump flags, PGO and LTO Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: christophm30 at gmail dot com Target Milestone: --- I ran into an ICE that was introduced by d6c1d7c400 (Jul 9). The ICEs shows up when compiling 520.omnetpp_r with PGO for RISC-V rv64gc with "-ggdb -fdump-tree-all-details -fdump-rtl-all-all -save-temps -dp -dA -fverbose-asm -fprofile-use -Ofast -funroll-loops". The relevant flags that trigger the ICEs are -fdump-tree-all-details, -fdump-rtl-all-all, or -dA. If non of these flags are present, then everything compiles fine. The ICE looks like this: during GIMPLE pass: tracer dump file: ./omnetpp_r.ltrans9.ltrans.194t.tracer model/MACRelayUnitBase.cc: In member function 'removeAgedEntriesFromTable': model/MACRelayUnitBase.cc:142:6: internal compiler error: Segmentation fault 142 | void MACRelayUnitBase::removeAgedEntriesFromTable() | ^ 0xeec4bf crash_signal /home/cm/src/gcc/riscv-test/gcc/toplev.cc:314 0x1a6e80f dump_bb_info(_IO_FILE*, basic_block_def*, int, dump_flag, bool, bool) /home/cm/src/gcc/riscv-test/gcc/cfg.cc:818 0x1a6ec52 brief_dump_cfg(_IO_FILE*, dump_flag) /home/cm/src/gcc/riscv-test/gcc/cfg.cc:900 0xeef99c execute /home/cm/src/gcc/riscv-test/gcc/tracer.cc:446 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. Bisecting shows that the following change introduces the issue: commit d6c1d7c4009bfe759719675ce3bc03ca503b9bf4 Date: Sun Jul 9 15:14:54 2023 +0200 Improve dumping of profile_count Dumps of profile_counts are quite hard to interpret since they are 64bit fixed point values. In many cases one looks at a single function and it is better to think of basic block frequency, that is how many times it is executed each invocatoin. This patch makes CFG dumps to also print this info. When removing/reverting this change (and adding all commits of upstream/master on top), then a second ICE shows up: during RTL pass: expand dump file: ./omnetpp_r.ltrans0.ltrans.258r.expand simulator/cdefaultlist.cc: In member function 'construct': simulator/cdefaultlist.cc:65:1: internal compiler error: in to_gcov_type, at profile-count.h:837 65 | } | ^ 0x861170 profile_count::to_gcov_type() const /home/cm/src/gcc/riscv-test/gcc/profile-count.h:837 0x861673 profile_count::to_gcov_type() const /home/cm/src/gcc/riscv-test/gcc/hash-set.h:125 0x861673 dump_prediction /home/cm/src/gcc/riscv-test/gcc/predict.cc:793 0xe69dc0 combine_predictions_for_insn /home/cm/src/gcc/riscv-test/gcc/predict.cc:1039 0xe69dc0 guess_outgoing_edge_probabilities(basic_block_def*) /home/cm/src/gcc/riscv-test/gcc/predict.cc:2356 0x1c6b26f compute_outgoing_frequencies /home/cm/src/gcc/riscv-test/gcc/cfgbuild.cc:692 0x1c6b26f find_many_sub_basic_blocks(simple_bitmap_def*) /home/cm/src/gcc/riscv-test/gcc/cfgbuild.cc:792 0xa5a60b execute /home/cm/src/gcc/riscv-test/gcc/cfgexpand.cc:6933 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. Bisecting shows that the following change introduces the issue: commit c69d9d2afd6ec4be37d0bfc26e0b2446df28a231 Date: Thu Jul 27 15:57:54 2023 +0200 Fix profile_count::apply_probability profile_count::apply_probability misses check for uninitialized probability which leads to completely random results on applying uninitialized probability to initialized scale. This can make difference when i.e. inlining -fno-guess-branch-probability function to -fguess-branch-probability one. However, this is not 100% accurate, since there is yet another ICE, which interferes in this context (and thus has tainted the bisect process): during RTL pass: expand dump file: ./omnetpp_r.ltrans0.ltrans.258r.expand simulator/cdisplaystring.cc: In member function 'insertTag': simulator/cdisplaystring.cc:276:1: internal compiler error: in to_gcov_type, at profile-count.h:831 276 | } | ^ 0x7faa34 profile_count::to_gcov_type() const /home/cm/src/gcc/riscv-test/gcc/profile-count.h:831 0x7faf37 profile_count::to_gcov_type() const /home/cm/src/gcc/riscv-test/gcc/hash-set.h:125 0x7faf37 dump_prediction /home/cm/src/gcc/riscv-test/gcc/predict.cc:797 0xdfafe0 combine_predictions_for_insn /home/cm/src/gcc/riscv-test/gcc/predict.cc:1039 0xdfafe0 guess_outgoing_edge_probabilities(basic_block_def*) /home/cm/src/gcc/riscv-test/gcc/predict.cc:2356 0x19bc4af compute_outgoing_frequencies /home/cm/src/gcc/riscv-test/gcc/cfgbuild.cc:692 0x19bc4af find_many_sub_basic_blocks(simple_bitmap_def*) /home/cm/src/gcc/riscv-test/gcc/cfgbuild.cc:792 0x9f0e0b execute /home/cm/src/gcc/riscv-test/gcc/cfgexpand.cc:6933 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report.