https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94224
Bug ID: 94224 Summary: [10 Regression] ICE: SIGSEGV in output_merged_store (gimple-ssa-store-merging.c:4304) with -O2 -fnon-call-exceptions testcase.C Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Created attachment 48065 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48065&action=edit reduced testcase (from OpenTTD sources) Compiler output: $ x86_64-pc-linux-gnu-g++ -O2 -fnon-call-exceptions testcase.C -wrapper valgrind,-q testcase.C: In function 'int operatorX(int&)': testcase.C:7:1: warning: no return statement in function returning non-void [-Wreturn-type] 7 | } | ^ ==21839== Invalid read of size 4 ==21839== at 0x1C09F4A: (anonymous namespace)::imm_store_chain_info::output_merged_store((anonymous namespace)::merged_store_group*) (gimple-ssa-store-merging.c:4304) ==21839== by 0x1C0C7AA: output_merged_stores (gimple-ssa-store-merging.c:4360) ==21839== by 0x1C0C7AA: terminate_and_process_chain (gimple-ssa-store-merging.c:4404) ==21839== by 0x1C0C7AA: (anonymous namespace)::pass_store_merging::terminate_and_process_chain((anonymous namespace)::imm_store_chain_info*) (gimple-ssa-store-merging.c:2206) ==21839== by 0x1C0DD3F: terminate_and_process_all_chains (gimple-ssa-store-merging.c:2141) ==21839== by 0x1C0DD3F: (anonymous namespace)::pass_store_merging::execute(function*) (gimple-ssa-store-merging.c:4950) ==21839== by 0x11447A7: execute_one_pass(opt_pass*) (passes.c:2502) ==21839== by 0x114511F: execute_pass_list_1(opt_pass*) (passes.c:2590) ==21839== by 0x1145131: execute_pass_list_1(opt_pass*) (passes.c:2591) ==21839== by 0x1145158: execute_pass_list(function*, opt_pass*) (passes.c:2601) ==21839== by 0xDAB6DB: cgraph_node::expand() (cgraphunit.c:2292) ==21839== by 0xDAC8AF: expand_all_functions (cgraphunit.c:2463) ==21839== by 0xDAC8AF: symbol_table::compile() [clone .part.0] (cgraphunit.c:2813) ==21839== by 0xDAEBAC: compile (cgraphunit.c:2726) ==21839== by 0xDAEBAC: symbol_table::finalize_compilation_unit() (cgraphunit.c:2993) ==21839== by 0x123052E: compile_file() (toplev.c:483) ==21839== by 0xA7E6B7: do_compile (toplev.c:2273) ==21839== by 0xA7E6B7: toplev::main(int, char**) (toplev.c:2412) ==21839== Address 0x24 is not stack'd, malloc'd or (recently) free'd ==21839== during GIMPLE pass: store-merging testcase.C: In function 'void x()': testcase.C:40:1: internal compiler error: Segmentation fault 40 | x () | ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. The original testcase didn't have the missing return statement; adding it prevents the ICE in the reduced testcase. $ x86_64-pc-linux-gnu-g++ -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-g++ COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r10-7276-20200319122247-g02f7334ac93-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.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-r10-7276-20200319122247-g02f7334ac93-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.0.1 20200319 (experimental) (GCC)