Bug 90282 - internal compiler error: qsort checking failed in snapshot-20190429
Summary: internal compiler error: qsort checking failed in snapshot-20190429
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: qsort_chk
  Show dependency treegraph
 
Reported: 2019-04-29 16:38 UTC by Jason Duerstock
Modified: 2022-12-20 22:22 UTC (History)
2 users (show)

See Also:
Host: ia64-linux-gnu
Target: ia64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-12-10 00:00:00


Attachments
gcc dump (239.68 KB, application/x-gzip)
2019-04-29 17:38 UTC, Jason Duerstock
Details
test-case (204.49 KB, application/x-bzip)
2019-12-10 13:31 UTC, Martin Liška
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Duerstock 2019-04-29 16:38:03 UTC
/home/jason/gcc-snapshot-20190429/build/./prev-gcc/xg++ -B/home/jason/gcc-snapshot-20190429/build/./prev-gcc/ -B/usr/lib/gcc-snapshot/ia64-linux-gnu/bin/ -nostdinc++ -B/home/jason/gcc-snapshot-20190429/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -B/home/jason/gcc-snapshot-20190429/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/home/jason/gcc-snapshot-20190429/build/prev-ia64-linux-gnu/libstdc++-v3/include/ia64-linux-gnu  -I/home/jason/gcc-snapshot-20190429/build/prev-ia64-linux-gnu/libstdc++-v3/include  -I/home/jason/gcc-snapshot-20190429/src/libstdc++-v3/libsupc++ -L/home/jason/gcc-snapshot-20190429/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -L/home/jason/gcc-snapshot-20190429/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c  -DUSE_LIBUNWIND_EXCEPTIONS  -g -O2 -fno-checking -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/dpd -I../libdecnumber -I../../src/gcc/../libbacktrace   -o cselib.o -MT cselib.o -MMD -MP -MF ./.deps/cselib.TPo ../../src/gcc/cselib.c
../../src/gcc/cselib.c: In function 'int rtx_equal_for_cselib_1(rtx, rtx, machine_mode, int)':
../../src/gcc/cselib.c:1044:1: error: qsort comparator non-negative on sorted output: 1
 1044 | }
      | ^
during RTL pass: mach
../../src/gcc/cselib.c:1044:1: internal compiler error: qsort checking failed
cc1plus(9051): unaligned access to 0x2000000002b302d4, ip=0x4000000004240841
cc1plus(9051): unaligned access to 0x2000000002b302d4, ip=0x4000000004240910
cc1plus(9051): unaligned access to 0x2000000002b302d4, ip=0x40000000042409b0
cc1plus(9051): unaligned access to 0x2000000002b3e6be, ip=0x4000000004240751
cc1plus(9051): unaligned access to 0x2000000002b3e6c6, ip=0x4000000004240841
0x400000000409cc2f qsort_chk_error
        ../../src/gcc/vec.c:211
0x400000000409db2f qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*))
        ../../src/gcc/vec.c:254
0x400000000415b3ef gcc_qsort(void*, unsigned long, unsigned long, int (*)(void const*, void const*))
        ../../src/gcc/sort.cc:238
0x4000000003cc658f ready_sort_real
        ../../src/gcc/haifa-sched.c:3097
0x4000000003cc66df ready_sort
        ../../src/gcc/haifa-sched.c:3113
0x4000000003ce2ecf schedule_block(basic_block_def**, void*)
        ../../src/gcc/haifa-sched.c:6700
0x4000000003efcfaf schedule_ebb(rtx_insn*, rtx_insn*, bool)
        ../../src/gcc/sched-ebb.c:537
0x4000000003efdd1f schedule_ebbs()
        ../../src/gcc/sched-ebb.c:656
0x400000000317624f ia64_reorg
        ../../src/gcc/config/ia64/ia64.c:9852
0x4000000002201f5f execute
        ../../src/gcc/reorg.c:3992
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
Comment 1 Jason Duerstock 2019-04-29 17:38:14 UTC
Created attachment 46264 [details]
gcc dump
Comment 2 Andreas Schwab 2019-04-29 18:41:04 UTC
Probably dup of bug 87281.
Comment 3 John Paul Adrian Glaubitz 2019-12-09 13:30:47 UTC
This problem is still present in r278870:

../../src/gcc/ubsan.c: In function 'tree_node* ubsan_type_descriptor(tree, ubsan_print_style)':
../../src/gcc/ubsan.c:409:33: warning: unterminated quote character ''' in format [-Wformat-diag]
  409 |       pp_printf (&pretty_name, "'%s%s%s%s%s%s%s",
      |                                 ^
../../src/gcc/ubsan.c:428:36: warning: spurious trailing space in format [-Wformat-diag]
  428 |       pp_printf (&pretty_name, "'%s ", tname);
      |                                    ^
../../src/gcc/ubsan.c:428:33: warning: unterminated quote character ''' in format [-Wformat-diag]
  428 |       pp_printf (&pretty_name, "'%s ", tname);
      |                                 ^
/<<PKGBUILDDIR>>/build/./prev-gcc/xg++ -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/lib/gcc-snapshot/ia64-linux-gnu/bin/ -nostdinc++ -B/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -B/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include/ia64-linux-gnu  -I/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include  -I/<<PKGBUILDDIR>>/src/libstdc++-v3/libsupc++ -L/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -L/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c  -DUSE_LIBUNWIND_EXCEPTIONS  -g -O2 -fno-checking -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/dpd -I../libdecnumber -I../../src/gcc/../libbacktrace   -o sancov.o -MT sancov.o -MMD -MP -MF ./.deps/sancov.TPo ../../src/gcc/sancov.c
/<<PKGBUILDDIR>>/build/./prev-gcc/xg++ -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/lib/gcc-snapshot/ia64-linux-gnu/bin/ -nostdinc++ -B/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -B/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include/ia64-linux-gnu  -I/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include  -I/<<PKGBUILDDIR>>/src/libstdc++-v3/libsupc++ -L/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -L/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c  -DUSE_LIBUNWIND_EXCEPTIONS  -g -O2 -fno-checking -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/dpd -I../libdecnumber -I../../src/gcc/../libbacktrace   -o tree-call-cdce.o -MT tree-call-cdce.o -MMD -MP -MF ./.deps/tree-call-cdce.TPo ../../src/gcc/tree-call-cdce.c
/<<PKGBUILDDIR>>/build/./prev-gcc/xg++ -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/lib/gcc-snapshot/ia64-linux-gnu/bin/ -nostdinc++ -B/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -B/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include/ia64-linux-gnu  -I/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include  -I/<<PKGBUILDDIR>>/src/libstdc++-v3/libsupc++ -L/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/src/.libs -L/<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c  -DUSE_LIBUNWIND_EXCEPTIONS  -g -O2 -fno-checking -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/dpd -I../libdecnumber -I../../src/gcc/../libbacktrace   -o tree-cfg.o -MT tree-cfg.o -MMD -MP -MF ./.deps/tree-cfg.TPo ../../src/gcc/tree-cfg.c
../../src/gcc/tree-call-cdce.c: In function 'void gen_shrink_wrap_conditions(gcall*, vec<gimple*>, unsigned int*)':
../../src/gcc/tree-call-cdce.c:793:1: error: qsort comparator non-negative on sorted output: 1
  793 | }
      | ^
during RTL pass: mach
../../src/gcc/tree-call-cdce.c:793:1: internal compiler error: qsort checking failed
0x40000000044ce41f qsort_chk_error
	../../src/gcc/vec.c:214
0x40000000044cf3bf qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*, void*), void*)
	../../src/gcc/vec.c:256
0x400000000458daaf gcc_qsort(void*, unsigned long, unsigned long, int (*)(void const*, void const*))
	../../src/gcc/sort.cc:270
0x40000000040b72ff ready_sort_real
	../../src/gcc/haifa-sched.c:3095
0x40000000040b744f ready_sort
	../../src/gcc/haifa-sched.c:3111
0x40000000040d3b9f schedule_block(basic_block_def**, void*)
	../../src/gcc/haifa-sched.c:6699
0x400000000431747f schedule_ebb(rtx_insn*, rtx_insn*, bool)
	../../src/gcc/sched-ebb.c:536
0x40000000043181ef schedule_ebbs()
	../../src/gcc/sched-ebb.c:655
0x400000000340e94f ia64_reorg
	../../src/gcc/config/ia64/ia64.c:9854
0x40000000024147ef execute
	../../src/gcc/reorg.c:3981
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccQzjkVp.out file, please attach this to your bugreport.

Compiler dump can see in Debian's build log: https://buildd.debian.org/status/fetch.php?pkg=gcc-snapshot&arch=ia64&ver=1%3A20191130-1&stamp=1575698799&raw=0

There have been a few snapshots after the 20190429 one where the problem didn't show, see: https://buildd.debian.org/status/logs.php?pkg=gcc-snapshot&arch=ia64
Comment 4 Andreas Schwab 2019-12-09 13:40:53 UTC
Workaround: use release checking.
Comment 5 John Paul Adrian Glaubitz 2019-12-10 12:02:45 UTC
(In reply to Andreas Schwab from comment #4)
> Workaround: use release checking.

Stupid question: How do I do that? Is there a switch that can be passed to the configure script?
Comment 6 Martin Liška 2019-12-10 12:05:23 UTC
(In reply to John Paul Adrian Glaubitz from comment #5)
> (In reply to Andreas Schwab from comment #4)
> > Workaround: use release checking.
> 
> Stupid question: How do I do that? Is there a switch that can be passed to
> the configure script?

-fno-checking, or -fchecking=0. I will take a look at the bug today.
Comment 7 John Paul Adrian Glaubitz 2019-12-10 12:08:57 UTC
(In reply to Martin Liška from comment #6)
> (In reply to John Paul Adrian Glaubitz from comment #5)
> > (In reply to Andreas Schwab from comment #4)
> > > Workaround: use release checking.
> > 
> > Stupid question: How do I do that? Is there a switch that can be passed to
> > the configure script?
> 
> -fno-checking, or -fchecking=0. I will take a look at the bug today.

Okay. Thanks. Let me know if you need access to an Itanium box. To my shame, I haven't managed to set up a GCC porterbox for ia64 yet which has been on my TODO list for quite a while.

Hopefully early next year.
Comment 8 Andreas Schwab 2019-12-10 12:54:38 UTC
--enable-checking=release
Comment 9 Martin Liška 2019-12-10 13:00:22 UTC
@John: Can you please attach a pre-processed source file (-E option). I should be able to reproduce that then with a cross compiler.
Comment 10 John Paul Adrian Glaubitz 2019-12-10 13:05:00 UTC
(In reply to Martin Liška from comment #9)
> @John: Can you please attach a pre-processed source file (-E option). I
> should be able to reproduce that then with a cross compiler.

Is the output after "=== BEGIN GCC DUMP ===" in the logfile what you need?

> https://buildd.debian.org/status/fetch.php?pkg=gcc-snapshot&arch=ia64&ver=1%3A20191130-1&stamp=1575698799&raw=0

Otherwise, I'll generate the pre-processed source as requested.
Comment 11 Martin Liška 2019-12-10 13:30:45 UTC
(In reply to John Paul Adrian Glaubitz from comment #10)
> (In reply to Martin Liška from comment #9)
> > @John: Can you please attach a pre-processed source file (-E option). I
> > should be able to reproduce that then with a cross compiler.
> 
> Is the output after "=== BEGIN GCC DUMP ===" in the logfile what you need?
> 
> > https://buildd.debian.org/status/fetch.php?pkg=gcc-snapshot&arch=ia64&ver=1%3A20191130-1&stamp=1575698799&raw=0
> 
> Otherwise, I'll generate the pre-processed source as requested.

Yes, the file is what I needed. However, I can't reproduce that with a cross compiler.
Comment 12 Martin Liška 2019-12-10 13:31:48 UTC
Created attachment 47459 [details]
test-case
Comment 13 Arseny Solokha 2019-12-10 16:11:07 UTC
This one should block PR82407.

Citing Jakub from PR84345 comment 2:
> Isn't this dup of the many other qsort checking issues in the scheduler?
> The scheduler qsort comparator is not valid comparator in many ways.
Comment 14 Jan-Benedict Glaw 2022-12-20 22:22:01 UTC
GCC 13 (as of g:02c031088ac0bbf) triggers this for Linux's kallsys.c (f9ff5644bcc04221bae56f922) for ia64.