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

            Bug ID: 105402
           Summary: ICE: in emit_swap_insn, at reg-stack.c:837 at -Og with
                    custom target flags
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

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

I don't know how much this relates to PR39607; there are no unitialized
variables, but there is dead code and undefined behavior (at runtime).

Compiler output:
$ x86_64-pc-linux-gnu-gcc -Og -mstringop-strategy=libcall
-fsanitize=integer-divide-by-zero -mregparm=3 -mtune=eden-x4 -m32 testcase.c
testcase.c: In function 'foo':
testcase.c:11:5: warning: division by zero [-Wdiv-by-zero]
   11 |   0 / 0;
      |     ^
during RTL pass: stack
testcase.c:12:1: internal compiler error: in emit_swap_insn, at
reg-stack.cc:843
   12 | }
      | ^
0x7b448f emit_swap_insn
        /repo/gcc-trunk/gcc/reg-stack.cc:843
0x1355cec move_for_stack_reg
        /repo/gcc-trunk/gcc/reg-stack.cc:1135
0x1358256 subst_stack_regs
        /repo/gcc-trunk/gcc/reg-stack.cc:2457
0x13586c9 convert_regs_1
        /repo/gcc-trunk/gcc/reg-stack.cc:3091
0x13586c9 convert_regs_2
        /repo/gcc-trunk/gcc/reg-stack.cc:3225
0x1359858 convert_regs
        /repo/gcc-trunk/gcc/reg-stack.cc:3260
0x1359858 reg_to_stack
        /repo/gcc-trunk/gcc/reg-stack.cc:3385
0x1359858 rest_of_handle_stack_regs
        /repo/gcc-trunk/gcc/reg-stack.cc:3441
0x1359858 execute
        /repo/gcc-trunk/gcc/reg-stack.cc:3473
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.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-8264-20220426101158-g7d31c678d68-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-8264-20220426101158-g7d31c678d68-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220426 (experimental) (GCC)

Reply via email to