https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103450
Bug ID: 103450 Summary: ICE: SIGSEGV in memory_operand (recog.c:1818) with -Og -fharden-compares -fschedule-insns2 -fno-tree-dce -fno-tree-fre 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 Created attachment 51888 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51888&action=edit reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc -Og -fharden-compares -fschedule-insns2 -fno-tree-dce -fno-tree-fre testcase.c -wrapper valgrind,-q ==19667== Invalid read of size 2 ==19667== at 0x12AEABC: memory_operand (recog.c:1818) ==19667== by 0x12AEABC: memory_operand(rtx_def*, machine_mode) (recog.c:1805) ==19667== by 0x1AC93A2: get_attr_memory(rtx_insn*) (i386.md:4995) ==19667== by 0x1EC7D58: insn_default_latency_generic(rtx_insn*) (i386.md:18795) ==19667== by 0x22DFFA1: insn_sched_cost (haifa-sched.c:1421) ==19667== by 0x22DFFA1: insn_sched_cost(rtx_insn*) (haifa-sched.c:1387) ==19667== by 0x22E5031: dep_cost_1(_dep*, unsigned int) (haifa-sched.c:1474) ==19667== by 0x22E6D29: dep_cost (haifa-sched.c:1510) ==19667== by 0x22E6D29: priority(rtx_insn*, bool) [clone .part.0] (haifa-sched.c:1661) ==19667== by 0x22E7623: priority (haifa-sched.c:1593) ==19667== by 0x22E7623: set_priorities(rtx_insn*, rtx_insn*) (haifa-sched.c:7166) ==19667== by 0x1304252: compute_priorities() (sched-rgn.c:3025) ==19667== by 0x1307065: schedule_region (sched-rgn.c:3118) ==19667== by 0x1307065: schedule_insns() [clone .part.0] (sched-rgn.c:3518) ==19667== by 0x13077CD: schedule_insns (sched-rgn.c:3504) ==19667== by 0x13077CD: rest_of_handle_sched2 (sched-rgn.c:3742) ==19667== by 0x13077CD: (anonymous namespace)::pass_sched2::execute(function*) (sched-rgn.c:3878) ==19667== by 0x125F63C: execute_one_pass(opt_pass*) (passes.c:2567) ==19667== by 0x125FEAF: execute_pass_list_1(opt_pass*) (passes.c:2656) ==19667== Address 0xabababababababab is not stack'd, malloc'd or (recently) free'd ==19667== during RTL pass: sched2 testcase.c: In function 'foo0': testcase.c:29:1: internal compiler error: Segmentation fault 29 | } | ^ 0x1368ecf crash_signal /repo/gcc-trunk/gcc/toplev.c:322 0x12aeabc memory_operand(rtx_def*, machine_mode) /repo/gcc-trunk/gcc/recog.c:1818 0x12aeabc memory_operand(rtx_def*, machine_mode) /repo/gcc-trunk/gcc/recog.c:1805 0x1ac93a2 get_attr_memory(rtx_insn*) /repo/gcc-trunk/gcc/config/i386/i386.md:4995 0x1ec7d58 insn_default_latency_generic(rtx_insn*) /repo/gcc-trunk/gcc/config/i386/i386.md:18795 0x22dffa1 insn_sched_cost(rtx_insn*) /repo/gcc-trunk/gcc/haifa-sched.c:1421 0x22dffa1 insn_sched_cost(rtx_insn*) /repo/gcc-trunk/gcc/haifa-sched.c:1387 0x22e5031 dep_cost_1(_dep*, unsigned int) /repo/gcc-trunk/gcc/haifa-sched.c:1474 0x22e6d29 dep_cost(_dep*) /repo/gcc-trunk/gcc/haifa-sched.c:1510 0x22e6d29 priority /repo/gcc-trunk/gcc/haifa-sched.c:1661 0x22e7623 priority /repo/gcc-trunk/gcc/haifa-sched.c:1593 0x22e7623 set_priorities(rtx_insn*, rtx_insn*) /repo/gcc-trunk/gcc/haifa-sched.c:7166 0x1304252 compute_priorities() /repo/gcc-trunk/gcc/sched-rgn.c:3025 0x1307065 schedule_region /repo/gcc-trunk/gcc/sched-rgn.c:3118 0x1307065 schedule_insns() /repo/gcc-trunk/gcc/sched-rgn.c:3518 0x13077cd schedule_insns() /repo/gcc-trunk/gcc/sched-rgn.c:3504 0x13077cd rest_of_handle_sched2 /repo/gcc-trunk/gcc/sched-rgn.c:3742 0x13077cd execute /repo/gcc-trunk/gcc/sched-rgn.c:3878 Please submit a full bug report, with preprocessed source if appropriate. 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-5555-20211127001619-gf4ed2e3ae7d-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/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-5555-20211127001619-gf4ed2e3ae7d-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 20211127 (experimental) (GCC)