public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sjames at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-113204-4-vkkfi6aRBB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113204-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113204

--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
I managed to run the test manually in `/usr/lib/go/src/cmd/link` with `go test
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 suite:
```
/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 <stdio.h>

void hello(void) {
  printf("hello\n");
}
*/
import "C"

func main() {
        hello := C.hello
        fmt.Printf("%v\n", hello)
}
```

```
/tmp/go-test $ cat go.mod
module cgolto
```


Then I get:
```
/tmp/go-test $ CGO_CFLAGS="-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 failed:
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<symtab_node*, va_heap, vl_embed>::sort(int (*)(void const*,
void const*, void*), void*)
        /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/vec.h:1232
0x63b5c1b289f4 vec<symtab_node*, va_heap, vl_ptr>::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()
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/lto-streamer-out.cc: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 <https://bugs.gentoo.org/> 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
```

  parent reply	other threads:[~2024-03-16  4:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 18:44 [Bug lto/113204] New: [14 Regression] " doko at gcc dot gnu.org
2024-01-02 18:51 ` [Bug lto/113204] " pinskia at gcc dot gnu.org
2024-01-06  6:15 ` pinskia at gcc dot gnu.org
2024-01-06  9:35 ` sjames at gcc dot gnu.org
2024-01-06  9:35 ` sjames at gcc dot gnu.org
2024-01-06  9:47 ` [Bug lto/113204] " pinskia at gcc dot gnu.org
2024-01-08 14:40 ` rguenth at gcc dot gnu.org
2024-02-02  7:27 ` xry111 at gcc dot gnu.org
2024-03-16  4:34 ` sjames at gcc dot gnu.org [this message]
2024-03-16  4:37 ` sjames at gcc dot gnu.org
2024-03-16  4:39 ` sjames at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113204-4-vkkfi6aRBB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).