https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82441
Bug ID: 82441 Summary: ICE on valid code at -O3: qsort checking failed Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- $ gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap Thread model: posix gcc version 8.0.0 20171005 (experimental) [trunk revision 253450] (GCC) $ $ gcctk -O2 small.c $ gcc-7.2.0 -O3 small.c $ $ gcctk -O3 small.c small.c: In function ‘fn1’: small.c:8:6: error: qsort comparator non-negative on sorted output: 1 void fn1 () ^~~ during GIMPLE pass: slp small.c:8:6: internal compiler error: qsort checking failed 0x66ef85 qsort_chk_error ../../gcc-source-trunk/gcc/vec.c:222 0x14dfc15 qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*)) ../../gcc-source-trunk/gcc/vec.c:274 0x14c1953 vec<data_reference*, va_heap, vl_embed>::qsort(int (*)(void const*, void const*)) ../../gcc-source-trunk/gcc/vec.h:973 0x14c1953 vec<data_reference*, va_heap, vl_ptr>::qsort(int (*)(void const*, void const*)) ../../gcc-source-trunk/gcc/vec.h:1735 0x14c1953 vect_analyze_data_ref_accesses(vec_info*) ../../gcc-source-trunk/gcc/tree-vect-data-refs.c:2802 0xf15f66 vect_slp_analyze_bb_1 ../../gcc-source-trunk/gcc/tree-vect-slp.c:2869 0xf15f66 vect_slp_bb(basic_block_def*) ../../gcc-source-trunk/gcc/tree-vect-slp.c:3034 0xf17865 execute ../../gcc-source-trunk/gcc/tree-vectorizer.c:998 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. $ ---------------------------------- struct A { short b; } c[1][4][9]; unsigned d, e, f, g; void fn1 () { for (; e; e++) ; if (f) for (d = 0; d < 4; d++) for (g = 0; g < 9; g++) { struct A i = { 1 }; c[f][d][g] = i; } } int main () { fn1 (); return 0; }