Created attachment 43258 [details] reduced testcase Compiler output: $ aarch64-unknown-linux-gnu-gcc -O2 -fno-sched-critical-path-heuristic -fno-sched-rank-heuristic --param=max-sched-extend-regions-iters=5 testcase.c testcase.c: In function 'foo': testcase.c:7:1: error: qsort comparator non-negative on sorted output: 1 } ^ during RTL pass: sched1 testcase.c:7:1: internal compiler error: qsort checking failed 0x5ec995 qsort_chk_error /repo/gcc-trunk/gcc/vec.c:201 0x156d5ca qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*)) /repo/gcc-trunk/gcc/vec.c:253 0x146c640 ready_sort_real /repo/gcc-trunk/gcc/haifa-sched.c:3087 0x14756ca schedule_block(basic_block_def**, void*) /repo/gcc-trunk/gcc/haifa-sched.c:6675 0xc1b7da schedule_region /repo/gcc-trunk/gcc/sched-rgn.c:3174 0xc1b7da schedule_insns() /repo/gcc-trunk/gcc/sched-rgn.c:3513 0xc1bc03 schedule_insns() /repo/gcc-trunk/gcc/sched-rgn.c:3498 0xc1bc03 rest_of_handle_sched /repo/gcc-trunk/gcc/sched-rgn.c:3717 0xc1bc03 execute /repo/gcc-trunk/gcc/sched-rgn.c:3825 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. $ aarch64-unknown-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-257087-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/8.0.1/lto-wrapper Target: aarch64-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/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu --with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld --with-as=/usr/bin/aarch64-unknown-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-257087-checking-yes-rtl-df-extra-aarch64 Thread model: posix gcc version 8.0.1 20180126 (experimental) (GCC)
Confirmed.
This may be a latent bug when the scheduling pressure model was changed, but FWIW, this started with r254378.
(In reply to Aldy Hernandez from comment #2) > This may be a latent bug when the scheduling pressure model was changed, but > FWIW, this started with r254378. Yes it's latent and the fix is trivial. Testing to see whether it affects codequality.
> Yes it's latent and the fix is trivial. Testing to see whether it affects > codequality. Thanks Wilco, I appreciate it. Errr, we all do :).
Author: wilco Date: Thu Feb 8 12:29:28 2018 New Revision: 257481 URL: https://gcc.gnu.org/viewcvs?rev=257481&root=gcc&view=rev Log: PR84068, PR83459: Fix sort order of SCHED_PRESSURE_MODEL The comparison function for SCHED_PRESSURE_MODEL is incorrect. If either instruction is not in target_bb, the ordering is not well defined. Since all instructions outside the target_bb get the highest model_index, all we need to do is sort on model_index. If the model_index is the same we defer to RFS_DEP_COUNT and/or RFS_TIE. gcc/ PR rtl-optimization/84068 PR rtl-optimization/83459 * haifa-sched.c (rank_for_schedule): Fix SCHED_PRESSURE_MODEL sorting. gcc/testsuite PR rtl-optimization/84068 PR rtl-optimization/83459 * gcc.dg/pr84068.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr84068.c Modified: trunk/gcc/ChangeLog trunk/gcc/haifa-sched.c trunk/gcc/testsuite/ChangeLog
Fixed in r257481.