Following ICEs: $ aarch64-linux-gnu-g++ /home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.other/crash15.C /dev/null -mcpu=cortex-a35 -O2 -fselective-scheduling /home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.other/crash15.C: In function ‘void test05()’: /home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.other/crash15.C:43:1: error: qsort comparator not anti-commutative: -1, -1 } ^ during RTL pass: sched1 /home/marxin/Programming/gcc/gcc/testsuite/g++.old-deja/g++.other/crash15.C:43:1: internal compiler error: qsort checking failed 0x5e693a qsort_chk_error .././../gcc/vec.c:201 0x15781dd qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*)) .././../gcc/vec.c:255 0xd77de4 vec<_expr*, va_heap, vl_embed>::qsort(int (*)(void const*, void const*)) .././../gcc/vec.h:1054 0xd77de4 vec<_expr*, va_heap, vl_ptr>::qsort(int (*)(void const*, void const*)) .././../gcc/vec.h:1816 0xd77de4 fill_vec_av_set .././../gcc/sel-sched.c:3953 0xd78df3 fill_ready_list .././../gcc/sel-sched.c:4027 0xd78df3 find_best_expr .././../gcc/sel-sched.c:4387 0xd78df3 fill_insns .././../gcc/sel-sched.c:5544 0xd7af80 schedule_on_fences .././../gcc/sel-sched.c:7361 0xd7af80 sel_sched_region_2 .././../gcc/sel-sched.c:7499 0xd7d4b1 sel_sched_region_1 .././../gcc/sel-sched.c:7541 0xd7d4b1 sel_sched_region(int) .././../gcc/sel-sched.c:7642 0xd7da99 run_selective_scheduling() .././../gcc/sel-sched.c:7718 0xd5a45d rest_of_handle_sched .././../gcc/sched-rgn.c:3715 0xd5a45d execute .././../gcc/sched-rgn.c:3825
Sorry, I cannot reproduce this. I've built a cross-compiler from today's trunk via 'configure --target aarch64-linux-gnu && make all-gcc' (i.e. just to cc1plus, no binutils etc.) and it doesn't abort. If possible please add 'g++ -v' output, svn revision, and any other info that can help me reproduce the issue.
Bah, built a wrong branch, not the trunk. I'll recheck later, sorry for the noise.
Confirmed. Our comparator breaks here: /* Prefer SCHED_GROUP_P insns to any others. */ if (SCHED_GROUP_P (tmp_insn) != SCHED_GROUP_P (tmp2_insn)) { if (VINSN_UNIQUE_P (tmp_vinsn) && VINSN_UNIQUE_P (tmp2_vinsn)) return SCHED_GROUP_P (tmp2_insn) ? 1 : -1; /* Now uniqueness means SCHED_GROUP_P is set, because schedule groups cannot be cloned. */ if (VINSN_UNIQUE_P (tmp2_vinsn)) return 1; return -1; } when we have two non-unique insns such that one is in a sched group. That is not supposed to happen actually, since SCHED_GROUP_P should imply VINSN_UNIQUE_P. This invariant is broken when sched_macro_fuse_insns sets SCHED_GROUP_P without looking at deps->readonly. So while we could get rid of the issue by rewriting the problematic sel-sched code in terms of SCHED_GROUP_P only, lack of deps->readonly check for macro-fusion seems like a bigger issue and should be fixed too.
Author: amonakov Date: Wed Apr 11 14:36:04 2018 New Revision: 259322 URL: https://gcc.gnu.org/viewcvs?rev=259322&root=gcc&view=rev Log: sched-deps: respect deps->readonly in macro-fusion (PR 84566) PR rtl-optimization/84566 * sched-deps.c (sched_analyze_insn): Check deps->readonly when invoking sched_macro_fuse_insns. Modified: trunk/gcc/ChangeLog trunk/gcc/sched-deps.c
Fixed.