After Alexander added the validation (r253295), we ICE on: ./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/tree-prof/pr44777.c -fira-algorithm=priority -Og /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/tree-prof/pr44777.c: In function ‘y’: /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/tree-prof/pr44777.c:31:5: error: qsort comparator non-negative on sorted output: 1 } ^ during RTL pass: ira /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/tree-prof/pr44777.c:31:5: internal compiler error: qsort checking failed 0x1b54377 qsort_chk_error ../../gcc/vec.c:222 0x1b5473f qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*)) ../../gcc/vec.c:274 0xd12e34 color_allocnos ../../gcc/ira-color.c:3087 0xd13887 color_pass ../../gcc/ira-color.c:3261 0xcf81b3 ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) ../../gcc/ira-build.c:1781 0xd141f6 do_coloring ../../gcc/ira-color.c:3412 0xd17f38 color ../../gcc/ira-color.c:4782 0xd185a4 ira_color() ../../gcc/ira-color.c:4897 0xcf2c3f ira ../../gcc/ira.c:5283 0xcf340e execute ../../gcc/ira.c:5581
I posted a candidate patch for review at https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00271.html
I tried the patch on an aarch64 bootstrap and it still fails, though the trace looks different. /home/sellcey/gcc-stdc/obj/gcc/aarch64-unknown-linux-gnu/libstdc++-v3/include/bits/deque.tcc:626:7: error: qsort comparator non-negative on sorted output: 8 } ^ during RTL pass: sched2 /home/sellcey/gcc-stdc/obj/gcc/aarch64-unknown-linux-gnu/libstdc++-v3/include/bits/deque.tcc:626:7: internal compiler error: qsort checking failed 0x1d1c5c7 qsort_chk_error ../../../src/gcc/gcc/vec.c:222 0x1d1c9e7 qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*)) ../../../src/gcc/gcc/vec.c:274 0x1be2ebf ready_sort_real ../../../src/gcc/gcc/haifa-sched.c:3087 0x1be2f53 ready_sort ../../../src/gcc/gcc/haifa-sched.c:3103 0x1bede13 schedule_block(basic_block_def**, void*) ../../../src/gcc/gcc/haifa-sched.c:6749 0x1285b9f schedule_region ../../../src/gcc/gcc/sched-rgn.c:3174 0x1286da3 schedule_insns() ../../../src/gcc/gcc/sched-rgn.c:3513 0x1287acf rest_of_handle_sched2 ../../../src/gcc/gcc/sched-rgn.c:3737 0x1287d2f execute ../../../src/gcc/gcc/sched-rgn.c:3873 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.
I am not sure if PR 82385 and PR 82396 are different bugs or not, they both involve qsort problems. I guess the aarch64 failure is PR 82396 and not this one, PR 82395.
*** Bug 82482 has been marked as a duplicate of this bug. ***
Author: amonakov Date: Thu Oct 19 16:48:34 2017 New Revision: 253904 URL: https://gcc.gnu.org/viewcvs?rev=253904&root=gcc&view=rev Log: ira-color: fix allocno_priority_compare_func for qsort (PR 82395) PR rtl-optimization/82395 * ira-color.c (allocno_priority_compare_func): Fix comparison step based on non_spilled_static_chain_regno_p. Modified: trunk/gcc/ChangeLog trunk/gcc/ira-color.c
Fixed.