https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119276

            Bug ID: 119276
           Summary: ICE: in cfg_layout_redirect_edge_and_branch_force, at
                    cfgrtl.cc:4747 with -O2 -fmodulo-sched
                    -freorder-blocks-and-partition
                    -fharden-conditional-branches
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: riscv64-unknown-linux-gnu

Created attachment 60746
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60746&action=edit
reduced testcase

Compiler output:
$ riscv64-unknown-linux-gnu-gcc -O2 -fmodulo-sched
-freorder-blocks-and-partition -fharden-conditional-branches testcase.c 
during RTL pass: sms
testcase.c: In function 'foo':
testcase.c:7:1: internal compiler error: in
cfg_layout_redirect_edge_and_branch_force, at cfgrtl.cc:4747
    7 | }
      | ^
0x364e6c1 internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:517
0x10e4f17 fancy_abort(char const*, int, char const*)
        /repo/gcc-trunk/gcc/diagnostic.cc:1722
0xab174f cfg_layout_redirect_edge_and_branch_force
        /repo/gcc-trunk/gcc/cfgrtl.cc:4747
0xab174f cfg_layout_redirect_edge_and_branch_force
        /repo/gcc-trunk/gcc/cfgrtl.cc:4743
0x12db213 redirect_edge_and_branch_force(edge_def*, basic_block_def*)
        /repo/gcc-trunk/gcc/cfghooks.cc:508
0x12dbcde make_forwarder_block(basic_block_def*, bool (*)(edge_def*), void
(*)(basic_block_def*))
        /repo/gcc-trunk/gcc/cfghooks.cc:920
0x12e3a05 merge_latch_edges
        /repo/gcc-trunk/gcc/cfgloop.cc:772
0x12e3a05 disambiguate_multiple_latches
        /repo/gcc-trunk/gcc/cfgloop.cc:823
0x12e3a05 disambiguate_loops_with_multiple_latches()
        /repo/gcc-trunk/gcc/cfgloop.cc:834
0x165cdf4 apply_loop_flags
        /repo/gcc-trunk/gcc/loop-init.cc:56
0x165d922 loop_optimizer_init(unsigned int)
        /repo/gcc-trunk/gcc/loop-init.cc:125
0x34ebe43 sms_schedule
        /repo/gcc-trunk/gcc/modulo-sched.cc:1361
0x34ee1cf execute
        /repo/gcc-trunk/gcc/modulo-sched.cc:3359
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ riscv64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-riscv64/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20250313184654-r15-8040-ga5d56278d145d4-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/15.0.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --with-isa-spec=2.2
--with-sysroot=/usr/riscv64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=riscv64-unknown-linux-gnu
--with-ld=/usr/bin/riscv64-unknown-linux-gnu-ld
--with-as=/usr/bin/riscv64-unknown-linux-gnu-as --disable-multilib
--enable-libsanitizer --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20250313184654-r15-8040-ga5d56278d145d4-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250313 (experimental) (GCC)

Reply via email to