https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104985
Bug ID: 104985 Summary: [12 Regression] ICE: SIGSEGV in undo_to_marker / adjust_reg_mode with -Os -frounding-math Product: gcc Version: 12.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: mips64el-unknown-linux-gnuabi64 Created attachment 52651 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52651&action=edit reduced testcase Compiler output: $ mips64el-unknown-linux-gnuabi64-gcc -Os -frounding-math testcase.c -wrapper valgrind,-q,--track-origins=yes testcase.c: In function 'main': testcase.c:87:14: warning: integer constant is so large that it is unsigned 87 | 14417272188526493017, 18446744073709551615, 0, 0, | ^~~~~~~~~~~~~~~~~~~~ testcase.c:87:36: warning: integer constant is so large that it is unsigned 87 | 14417272188526493017, 18446744073709551615, 0, 0, | ^~~~~~~~~~~~~~~~~~~~ testcase.c:88:14: warning: integer constant is so large that it is unsigned 88 | 13365776591774966959, | ^~~~~~~~~~~~~~~~~~~~ testcase.c:89:14: warning: integer constant is so large that it is unsigned 89 | 18446744073709551615, (C) { 526289, 88628 }, (C) { 5 }, | ^~~~~~~~~~~~~~~~~~~~ ==21781== Invalid read of size 8 ==21781== at 0x17325FF: undo_to_marker(void*) (combine.cc:4758) ==21781== by 0x1751586: undo_all (combine.cc:4779) ==21781== by 0x1751586: try_combine(rtx_insn*, rtx_insn*, rtx_insn*, rtx_insn*, int*, rtx_insn*) (combine.cc:3353) ==21781== by 0x175B056: combine_instructions (combine.cc:1288) ==21781== by 0x175B056: rest_of_handle_combine (combine.cc:14931) ==21781== by 0x175B056: (anonymous namespace)::pass_combine::execute(function*) (combine.cc:14976) ==21781== by 0xE28999: execute_one_pass(opt_pass*) (passes.cc:2637) ==21781== by 0xE2925F: execute_pass_list_1(opt_pass*) (passes.cc:2737) ==21781== by 0xE29271: execute_pass_list_1(opt_pass*) (passes.cc:2738) ==21781== by 0xE29298: execute_pass_list(function*, opt_pass*) (passes.cc:2748) ==21781== by 0xA52AC5: expand (cgraphunit.cc:1834) ==21781== by 0xA52AC5: cgraph_node::expand() (cgraphunit.cc:1787) ==21781== by 0xA5400F: expand_all_functions (cgraphunit.cc:1998) ==21781== by 0xA5400F: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2348) ==21781== by 0xA56C47: compile (cgraphunit.cc:2261) ==21781== by 0xA56C47: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2529) ==21781== by 0xF3858F: compile_file() (toplev.cc:479) ==21781== by 0x89CFEA: do_compile (toplev.cc:2168) ==21781== by 0x89CFEA: toplev::main(int, char**) (toplev.cc:2320) ==21781== Address 0x4865c48 is in a rw- anonymous segment ==21781== ==21781== Invalid read of size 1 ==21781== at 0xB159DB: adjust_reg_mode(rtx_def*, machine_mode) (emit-rtl.cc:1294) ==21781== by 0x1732606: undo_to_marker(void*) (combine.cc:4758) ==21781== by 0x1751586: undo_all (combine.cc:4779) ==21781== by 0x1751586: try_combine(rtx_insn*, rtx_insn*, rtx_insn*, rtx_insn*, int*, rtx_insn*) (combine.cc:3353) ==21781== by 0x175B056: combine_instructions (combine.cc:1288) ==21781== by 0x175B056: rest_of_handle_combine (combine.cc:14931) ==21781== by 0x175B056: (anonymous namespace)::pass_combine::execute(function*) (combine.cc:14976) ==21781== by 0xE28999: execute_one_pass(opt_pass*) (passes.cc:2637) ==21781== by 0xE2925F: execute_pass_list_1(opt_pass*) (passes.cc:2737) ==21781== by 0xE29271: execute_pass_list_1(opt_pass*) (passes.cc:2738) ==21781== by 0xE29298: execute_pass_list(function*, opt_pass*) (passes.cc:2748) ==21781== by 0xA52AC5: expand (cgraphunit.cc:1834) ==21781== by 0xA52AC5: cgraph_node::expand() (cgraphunit.cc:1787) ==21781== by 0xA5400F: expand_all_functions (cgraphunit.cc:1998) ==21781== by 0xA5400F: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2348) ==21781== by 0xA56C47: compile (cgraphunit.cc:2261) ==21781== by 0xA56C47: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2529) ==21781== by 0xF3858F: compile_file() (toplev.cc:479) ==21781== Address 0xa5a5a5a5a5a5a5a7 is not stack'd, malloc'd or (recently) free'd ==21781== during RTL pass: combine testcase.c:107:1: internal compiler error: Segmentation fault 107 | } | ^ 0xf382cf crash_signal /repo/gcc-trunk/gcc/toplev.cc:322 0xb159db adjust_reg_mode(rtx_def*, machine_mode) /repo/gcc-trunk/gcc/emit-rtl.cc:1294 0x1732606 undo_to_marker /repo/gcc-trunk/gcc/combine.cc:4758 0x1751586 undo_all /repo/gcc-trunk/gcc/combine.cc:4779 0x1751586 try_combine /repo/gcc-trunk/gcc/combine.cc:3353 0x175b056 combine_instructions /repo/gcc-trunk/gcc/combine.cc:1288 0x175b056 rest_of_handle_combine /repo/gcc-trunk/gcc/combine.cc:14931 0x175b056 execute /repo/gcc-trunk/gcc/combine.cc:14976 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. $ mips64el-unknown-linux-gnuabi64-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-mips64el/bin/mips64el-unknown-linux-gnuabi64-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-7721-20220319135312-gb60bc913cca-checking-yes-rtl-df-extra-mips64el/bin/../libexec/gcc/mips64el-unknown-linux-gnuabi64/12.0.1/lto-wrapper Target: mips64el-unknown-linux-gnuabi64 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/mips64el-unknown-linux-gnuabi64 --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=mips64el-unknown-linux-gnuabi64 --with-ld=/usr/bin/mips64el-unknown-linux-gnuabi64-ld --with-as=/usr/bin/mips64el-unknown-linux-gnuabi64-as --disable-multilib --with-abi=64 --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r12-7721-20220319135312-gb60bc913cca-checking-yes-rtl-df-extra-mips64el Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.1 20220319 (experimental) (GCC)