From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 84647385800D; Sat, 16 Mar 2024 04:34:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84647385800D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710563681; bh=Qgp21iJDaHswjVeMqe2jdCspql5QvrDP7FBGEoWOKA0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yqpTp+QCFdI7bbSiqKbFmqFFNFU85Y5wHQsbFGhrLgfbvDeWA2+nF7A8Nz+MNnQpG 27sHa14Nr+LTAtc3oY1eZWwzL5I6Oabi/74xA8n1puCOKJxx4X4oCt/FK/252uDPzV UrAs3hEaS2o8xIZGWbJDkKgi0Rw7ar5sQbI6OO9M= From: "sjames at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/113204] lto1: error: qsort comparator non-negative on sorted output: 64 Date: Sat, 16 Mar 2024 04:34:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code, lto, testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: sjames at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113204 --- Comment #6 from Sam James --- I managed to run the test manually in `/usr/lib/go/src/cmd/link` with `go t= est cgo_test.go -x -v` and made writeTempFile dump the name/contents. At least now I can reproduce with just one command outside of the test suit= e: ``` /tmp/go-test $ cat add.go package main import "C" /* test */ //export myadd func myadd(a C.int, b C.int) C.int { return a + b } ``` ``` /tmp/go-test $ cat main.go package main import "fmt" /* #include void hello(void) { printf("hello\n"); } */ import "C" func main() { hello :=3D C.hello fmt.Printf("%v\n", hello) } ``` ``` /tmp/go-test $ cat go.mod module cgolto ``` Then I get: ``` /tmp/go-test $ CGO_CFLAGS=3D"-O2 -g -flto" /usr/lib/go/bin/go build # cgolto /usr/lib/go/pkg/tool/linux_amd64/link: running x86_64-pc-linux-gnu-gcc fail= ed: exit status 1 lto1: error: qsort comparator non-negative on sorted output: 64 during IPA pass: static-var lto1: internal compiler error: qsort checking failed 0x63b5c1913cd6 qsort_chk_error /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/vec.cc:204 0x63b5c0397d4d qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*, void*), void*) /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/vec.cc:246 0x63b5c1d34457 gcc_sort_r(void*, unsigned long, unsigned long, int (*)(void const*, void const*, void*), void*) /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/sort.cc:296 0x63b5c1b289f4 vec::sort(int (*)(void cons= t*, void const*, void*), void*) /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/vec.h:1232 0x63b5c1b289f4 vec::sort(int (*)(void const*, void const*, void*), void*) /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/vec.h:2252 0x63b5c1b289f4 lto_output() =20=20=20=20=20=20=20 /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto-streamer-out.c= c:2799 0x63b5c21e6365 write_lto /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/passes.cc:= 2779 0x63b5c21e2c9e ipa_write_optimization_summaries(lto_symtab_encoder_d*) /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/passes.cc:= 2969 0x63b5c21e1f94 stream_out /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto/lto.cc= :179 0x63b5c21e1f94 stream_out_partitions_1 /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto/lto.cc= :231 0x63b5c21abd7a stream_out_partitions /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto/lto.cc= :246 0x63b5c21abd7a lto_wpa_write_files /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto/lto.cc= :419 0x63b5c21abd7a do_whole_program_analysis /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto/lto.cc= :594 0x63b5c21abd7a lto_main() /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto/lto.cc= :668 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. lto-wrapper: fatal error: x86_64-pc-linux-gnu-gcc returned 1 exit status compilation terminated. /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status ```=