Bug 98504 - [11/12/13/14 Regression] bootstrap broken in libgo on ia64-linux-gnu
Summary: [11/12/13/14 Regression] bootstrap broken in libgo on ia64-linux-gnu
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 11.0
: P4 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2021-01-03 12:08 UTC by Matthias Klose
Modified: 2023-05-29 10:03 UTC (History)
5 users (show)

See Also:
Host:
Target: ia64-linux-gnu
Build:
Known to work: 10.2.1
Known to fail: 11.0
Last reconfirmed: 2021-04-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2021-01-03 12:08:34 UTC
seen with trunk 20210102 on ia64-linux-gnu:

go1: internal compiler error: Segmentation fault
0x400000000126cfcf crash_signal
        ../../src/gcc/toplev.c:327
0x4000000002de14df std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::substr(unsigned long, unsigned long) const
        /<<PKGBUILDDIR>>/build/ia64-linux-gnu/libstdc++-v3/include/bits/basic_string.h:907
0x400000000036e3ff Gogo::special_name_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
        ../../src/gcc/go/gofrontend/names.cc:1193
0x400000000023783f should_export
        ../../src/gcc/go/gofrontend/export.cc:464
0x400000000023c99f Export::export_globals(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Package*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, Package*> > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Package*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, Package*> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Import_init_set const&, Bindings const*, std::unordered_set<Named_object*, std::hash<Named_object*>, std::equal_to<Named_object*>, std::allocator<Named_object*> >*)
        ../../src/gcc/go/gofrontend/export.cc:573
0x40000000003ae35f Gogo::do_exports()
        /<<PKGBUILDDIR>>/build/prev-ia64-linux-gnu/libstdc++-v3/include/bits/basic_string.h:907
0x400000000035dbef Gogo::do_exports()
        ../../src/gcc/go/gofrontend/gogo.cc:5201
0x400000000035dbef go_parse_input_files(char const**, unsigned int, bool, bool)
        ../../src/gcc/go/gofrontend/go.cc:157
0x40000000002f4aff go_langhook_parse_file
        ../../src/gcc/go/go-lang.c:352
Please submit a full bug report,
with preprocessed source if appropriate.

configured with:
         --enable-languages=c,c++,go,d,fortran,objc,obj-c++
         --prefix=/usr/lib/gcc-snapshot
         --with-gcc-major-version-only
         --program-prefix=
         --enable-shared
         --enable-linker-build-id
         --disable-nls
         --enable-clocale=gnu
         --enable-libstdcxx-debug
         --enable-libstdcxx-time=yes
         --with-default-libstdcxx-abi=new
         --enable-gnu-unique-object
         --disable-libssp
         --disable-libitm
         --disable-libsanitizer
         --enable-plugin
         --with-system-zlib
         --disable-libphobos
         --enable-objc-gc=auto
         --enable-multiarch
         --disable-werror
         --with-system-libunwind
         --enable-checking=yes
         --build=ia64-linux-gnu
         --host=ia64-linux-gnu
         --target=ia64-linux-gnu
         --with-build-config=bootstrap-lto-lean
         --enable-link-serialization=1
Comment 1 Matthias Klose 2021-01-03 12:10:16 UTC
make[6]: *** [Makefile:2962: runtime.lo] Error 1
make[6]: Leaving directory '/<<PKGBUILDDIR>>/build/ia64-linux-gnu/libgo'
make[5]: *** [Makefile:2292: all-recursive] Error 1
make[5]: Leaving directory '/<<PKGBUILDDIR>>/build/ia64-linux-gnu/libgo'
make[4]: *** [Makefile:1187: all] Error 2
make[4]: Leaving directory '/<<PKGBUILDDIR>>/build/ia64-linux-gnu/libgo'
make[3]: *** [Makefile:21385: all-target-libgo] Error 2
Comment 2 Andreas Schwab 2021-01-03 12:17:07 UTC
Does it also fail without LTO?
Comment 3 Ian Lance Taylor 2021-01-04 21:16:19 UTC
Maybe I'm missing something obvious, but I don't see how this is possible.  The code in the Go frontend is

  if (suffix.compare(2, 5, "thunk") == 0
      && Gogo::is_digits(suffix.substr(7)))
    return pos;

The crash is apparently occurring on the call to suffix.substr(7).  Given that suffix.compare already worked, there should be no way that that code could crash.

So to me this looks like a miscompilation of the Go frontend code, rather than a bug in the Go frontend.
Comment 4 Matthias Klose 2021-02-01 15:55:29 UTC
a trunk 20210130 build without LTO did succeed.
Comment 5 Richard Biener 2021-04-09 08:02:59 UTC
Matthias, what's the state on current trunk?
Comment 6 John Paul Adrian Glaubitz 2021-04-09 08:34:57 UTC
(In reply to Richard Biener from comment #5)
> Matthias, what's the state on current trunk?

I can test this for Matthias on my own machine as the new ia64 porterbox that we set up in Debian is currently having connection issues with the LDAP database.

I will try to get the machine fixed over the weekend.
Comment 7 Jakub Jelinek 2021-04-27 11:40:01 UTC
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
Comment 8 Richard Biener 2021-07-28 07:05:39 UTC
GCC 11.2 is being released, retargeting bugs to GCC 11.3
Comment 9 Richard Biener 2022-01-17 15:05:03 UTC
Any update on the status on current trunk?
Comment 10 John Paul Adrian Glaubitz 2022-01-17 15:07:41 UTC
(In reply to Richard Biener from comment #9)
> Any update on the status on current trunk?

I can give it a try later this week. We have a new shiny ia64 porterbox in Debian now :-).
Comment 11 John Paul Adrian Glaubitz 2022-01-18 19:06:06 UTC
(In reply to John Paul Adrian Glaubitz from comment #10)
> (In reply to Richard Biener from comment #9)
> > Any update on the status on current trunk?
> 
> I can give it a try later this week. We have a new shiny ia64 porterbox in
> Debian now :-).

So, I just did a bootstrap build with

$ ../configure --prefix=$HOME/gcc-install --enable-multilib --enable-languages=c,c++,go --with-system-libunwind

and it built fine without any issues.

Trying to build a simple Go program failed however due to an unrelated error:

(sid_ia64-dchroot)glaubitz@yttrium:~/gcc-install/bin$ ./gccgo ~/hello.go 
/home/glaubitz/hello.go:5:11: error: import file 'fmt' not found
    5 | import "fmt"
      |           ^
/home/glaubitz/hello.go:10:5: error: reference to undefined name 'fmt'
   10 |     fmt.Println("hello world")
      |     ^
(sid_ia64-dchroot)glaubitz@yttrium:~/gcc-install/bin$

I'm not a GO expert, so no idea how to tell the Go compiler where the libraries are located.
Comment 12 Ian Lance Taylor 2022-01-18 21:25:57 UTC
You can pass the -I option to tell the compiler where to find the fmt.gox file.

But, of course, you shouldn't have to.  A "make install" should put fmt.gox in the right place by default.  I don't know why you are seeing a problem there.
Comment 13 John Paul Adrian Glaubitz 2022-01-18 22:02:04 UTC
(In reply to Ian Lance Taylor from comment #12)
> But, of course, you shouldn't have to.  A "make install" should put fmt.gox
> in the right place by default.  I don't know why you are seeing a problem
> there.

I gave it a try again. Compiling works, but the program crashes:

glaubitz@yttrium:~$ gccgo hello.go -o hello
glaubitz@yttrium:~$ ./hello 
Aborted
glaubitz@yttrium:~$
Comment 14 Richard Biener 2022-01-19 07:33:09 UTC
(In reply to John Paul Adrian Glaubitz from comment #11)
> (In reply to John Paul Adrian Glaubitz from comment #10)
> > (In reply to Richard Biener from comment #9)
> > > Any update on the status on current trunk?
> > 
> > I can give it a try later this week. We have a new shiny ia64 porterbox in
> > Debian now :-).
> 
> So, I just did a bootstrap build with
> 
> $ ../configure --prefix=$HOME/gcc-install --enable-multilib
> --enable-languages=c,c++,go --with-system-libunwind
> 
> and it built fine without any issues.

Btw, that was never broken - broken was a build with --with-build-config=bootstrap-lto-lean

I'd still be interested if that now works.

P4 as default config bootstrap never was broken and ia64-linux isn't primary or secondary.
Comment 15 Richard Biener 2022-04-21 07:48:31 UTC
GCC 11.3 is being released, retargeting bugs to GCC 11.4.
Comment 16 Jakub Jelinek 2023-05-29 10:03:52 UTC
GCC 11.4 is being released, retargeting bugs to GCC 11.5.