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

            Bug ID: 91683
           Summary: ICE: SIGSEGV at -O when compiling for riscv64
           Product: gcc
           Version: 10.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 46842
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46842&action=edit
reduced testcase

Compiler output:
$ riscv64-unknown-linux-gnu-gcc -O testcase.c -wrapper
valgrind,-q,--track-origins=yes
==21541== Invalid read of size 8
==21541==    at 0x13005E7: undo_to_marker(void*) (combine.c:4898)
==21541==    by 0x1329BC1: undo_all (combine.c:4919)
==21541==    by 0x1329BC1: try_combine(rtx_insn*, rtx_insn*, rtx_insn*,
rtx_insn*, int*, rtx_insn*) (combine.c:3500)
==21541==    by 0x13333AB: combine_instructions (combine.c:1327)
==21541==    by 0x13333AB: rest_of_handle_combine (combine.c:15067)
==21541==    by 0x13333AB: (anonymous
namespace)::pass_combine::execute(function*) (combine.c:15112)
==21541==    by 0xC94539: execute_one_pass(opt_pass*) (passes.c:2494)
==21541==    by 0xC94CD7: execute_pass_list_1(opt_pass*) (passes.c:2580)
==21541==    by 0xC94CE9: execute_pass_list_1(opt_pass*) (passes.c:2581)
==21541==    by 0xC94D28: execute_pass_list(function*, opt_pass*)
(passes.c:2591)
==21541==    by 0x94DC0C: cgraph_node::expand() (cgraphunit.c:2194)
==21541==    by 0x94EC0C: expand_all_functions (cgraphunit.c:2332)
==21541==    by 0x94EC0C: symbol_table::compile() [clone .part.66]
(cgraphunit.c:2688)
==21541==    by 0x95152C: compile (cgraphunit.c:2595)
==21541==    by 0x95152C: symbol_table::finalize_compilation_unit()
(cgraphunit.c:2868)
==21541==    by 0xD95348: compile_file() (toplev.c:481)
==21541==    by 0x7ADAF7: do_compile (toplev.c:2166)
==21541==    by 0x7ADAF7: toplev::main(int, char**) (toplev.c:2301)
==21541==  Address 0x5432458 is in a rw- anonymous segment
==21541== 
==21541== Invalid read of size 1
==21541==    at 0x9F9B7B: adjust_reg_mode(rtx_def*, machine_mode)
(emit-rtl.c:1279)
==21541==    by 0x13005EE: undo_to_marker(void*) (combine.c:4898)
==21541==    by 0x1329BC1: undo_all (combine.c:4919)
==21541==    by 0x1329BC1: try_combine(rtx_insn*, rtx_insn*, rtx_insn*,
rtx_insn*, int*, rtx_insn*) (combine.c:3500)
==21541==    by 0x13333AB: combine_instructions (combine.c:1327)
==21541==    by 0x13333AB: rest_of_handle_combine (combine.c:15067)
==21541==    by 0x13333AB: (anonymous
namespace)::pass_combine::execute(function*) (combine.c:15112)
==21541==    by 0xC94539: execute_one_pass(opt_pass*) (passes.c:2494)
==21541==    by 0xC94CD7: execute_pass_list_1(opt_pass*) (passes.c:2580)
==21541==    by 0xC94CE9: execute_pass_list_1(opt_pass*) (passes.c:2581)
==21541==    by 0xC94D28: execute_pass_list(function*, opt_pass*)
(passes.c:2591)
==21541==    by 0x94DC0C: cgraph_node::expand() (cgraphunit.c:2194)
==21541==    by 0x94EC0C: expand_all_functions (cgraphunit.c:2332)
==21541==    by 0x94EC0C: symbol_table::compile() [clone .part.66]
(cgraphunit.c:2688)
==21541==    by 0x95152C: compile (cgraphunit.c:2595)
==21541==    by 0x95152C: symbol_table::finalize_compilation_unit()
(cgraphunit.c:2868)
==21541==    by 0xD95348: compile_file() (toplev.c:481)
==21541==  Address 0xa5a5a5a5a5a5a5a7 is not stack'd, malloc'd or (recently)
free'd
==21541== 
during RTL pass: combine
testcase.c: In function 'foo':
testcase.c:25:1: internal compiler error: Segmentation fault
   25 | }
      | ^
Please submit a full bug report,
with preprocessed source if appropriate.
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-275449-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/10.0.0/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-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
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-275449-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.0 20190906 (experimental) (GCC)

Reply via email to