Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 728586 - sys-devel/gcc-10.1.0-r1: gcc-10.1.0/gcc/tree-ssa-reassoc.c:4754:1: internal compiler error: Segmentation fault (skylake)
Summary: sys-devel/gcc-10.1.0-r1: gcc-10.1.0/gcc/tree-ssa-reassoc.c:4754:1: internal c...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-17 19:01 UTC by Jeffrey Lin
Modified: 2023-08-23 01:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (gcc-10.1.0-r1:20200617-141237.log.xz,144.22 KB, application/x-xz)
2020-06-17 19:01 UTC, Jeffrey Lin
Details
emerge --info (emergeinfo,21.49 KB, text/plain)
2020-06-17 19:10 UTC, Jeffrey Lin
Details
build.log -j4, now with gcc-10.1.0-r1 (gcc-10.1.0-r1:20200618-191042.log.xz,113.26 KB, application/x-xz)
2020-06-18 20:59 UTC, Jeffrey Lin
Details
build.log (gcc-10.1.0-r1:20200618-233110.log.xz,114.88 KB, application/x-xz)
2020-06-19 05:18 UTC, Jeffrey Lin
Details
build.log without -pipe (gcc-10.1.0-r1:20200619-161204.log.xz,144.79 KB, application/x-xz)
2020-06-19 20:59 UTC, Jeffrey Lin
Details
Build log for gcc-11.1.0-r2 -j32 (buildlog-gcc-11.1.tar.xz,143.49 KB, application/x-xz)
2021-07-09 13:08 UTC, Adel KARA SLIMANE
Details
emerge pqv (emerge-pqv-gcc-11.1.0-r2,291 bytes, text/plain)
2021-07-09 13:09 UTC, Adel KARA SLIMANE
Details
emerge info (emerge-info-gcc-11.1.0-r2,7.67 KB, text/plain)
2021-07-09 13:09 UTC, Adel KARA SLIMANE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Lin 2020-06-17 19:01:06 UTC
Created attachment 645118 [details]
build.log

/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/config/i386/i386-expand.c:7898:7: note: 'vec[1]' was declared here
 7898 |   rtx vec[3];
      |       ^
/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/config/i386/i386-expand.c: In function 'ix86_expand_call':
/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/emit-rtl.c:1090:1: warning: 'vec[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1090 |     rt_val->elem[i] = *argp++;
      | ^
/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/config/i386/i386-expand.c:7898:7: note: 'vec[1]' was declared here
 7898 |   rtx vec[3];
      |       ^
during RTL pass: loop2_done
/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/tree-ssa-reassoc.c: In function 'remove_visited_stmt_chain':
/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/tree-ssa-reassoc.c:4754:1: internal compiler error: Segmentation fault
 4754 | }
      | ^
0x7f91b49557df ???
        /tmp/portage/sys-libs/glibc-2.31-r5/work/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
make[4]: *** [/tmp/portage/sys-devel/gcc-10.1.0-r1/temp/ccvsgKx0.mk:176: /tmp/portage/sys-devel/gcc-10.1.0-r1/temp/cc1.fi4uN2.ltrans58.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/x86_64-pc-linux-gnu/bin/ld: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[3]: *** [/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/c/Make-lang.in:85: cc1] Error 1

See attached build.log
Comment 1 Jeffrey Lin 2020-06-17 19:10:17 UTC
Created attachment 645120 [details]
emerge --info
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-17 21:25:58 UTC
Any chance it sould be a resource (RAM / disk) exhaustion? Does 'dmesg' report any OOMs?

I think 'during RTL pass: loop2_done' implies it's an internal gcc memory corruption. Can you reliably reproduce the failure if you build with MAKEOPTS=-j1?

We'll need to narrow down set of special options. Some examples:
- USE=-lto
- USE=-pgo
- -march=native -> -march=${cpu}
- lg.gold -> ld.lfd

Also, to get a better backtrace try to add '-g' to CFLAGS and CXXFLAGS and get a gdb backtrace. Should be a matter of:
  $ file path/to/core
  $ gdb path/to/file path/to/core
  $ bt
Comment 3 Jeffrey Lin 2020-06-18 20:59:43 UTC
Created attachment 645188 [details]
build.log -j4, now with gcc-10.1.0-r1

(In reply to Sergei Trofimovich from comment #2)
> Any chance it sould be a resource (RAM / disk) exhaustion? Does 'dmesg'
> report any OOMs?

No, I'm doubtful this is the case as I have plenty of free RAM (even while compiling in tmpfs).

> Can you reliably reproduce the failure if you build with MAKEOPTS=-j1?

emerging was successful with -j1. Switching back to -j4 (now with the -r1 compiler) produces a similar ICE. Based on log size, it seems to happen earlier in the process now, although I've yet to rebuild with the same configuration twice to see if it happens in a predictable place every time.

> We'll need to narrow down set of special options.

Now rebuilding with USE='-lto -pgo' and -j4.
Comment 4 Jeffrey Lin 2020-06-19 05:18:36 UTC
Created attachment 645198 [details]
build.log

Disabled many USE flags in an attempt at minimization:

[ebuild   R   ] sys-devel/gcc-10.1.0-r1  USE="(cxx) fortran lto (multilib) nptl openmp (pie) ssp vtv zstd (-ada) -d -debug -doc (-fixed-point) -go -graphite* (-hardened) (-jit) (-libssp) -nls -objc -objc++ -objc-gc -pch* -pgo* -sanitize* -systemtap -test -vanilla"
Comment 5 Jeffrey Lin 2020-06-19 20:59:43 UTC
Created attachment 645274 [details]
build.log without -pipe

This build was the same as above, without -pipe now.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-20 19:24:41 UTC
I attempted to reproduce the crash on skylake machine and did not succeed with either all of your MAKEOPTS/CFLAGS/CXXFLAGS/LDFLAGS/USE flags or -march=native changed to march=skylake.

That might suggest it's a race in build system or a tricky hardware problem.

You might want to start a fresh stage3 chroot and gradually add flags there to see what adds to the trigger. So far you still have too many unique CFLAGS and packages form overlays.
Comment 7 Adel KARA SLIMANE 2021-07-09 13:05:21 UTC
I have encountered the error with gcc-10.1.0-r2 and a znver3 CPU (5950X) but I am not sure it's the exact same issue as the internal compiler error happens at a different point.

so it doesn't seem to be related to -march. I have never encountered this issue before, with the same flags. Maybe it's related to bug #723738 I will try a -j1 build.
Comment 8 Adel KARA SLIMANE 2021-07-09 13:08:40 UTC
Created attachment 722911 [details]
Build log for gcc-11.1.0-r2 -j32
Comment 9 Adel KARA SLIMANE 2021-07-09 13:09:05 UTC
Created attachment 722914 [details]
emerge pqv
Comment 10 Adel KARA SLIMANE 2021-07-09 13:09:24 UTC
Created attachment 722917 [details]
emerge info
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2021-07-09 13:20:48 UTC
(In reply to Adel KARA SLIMANE from comment #7)
> I have encountered the error with gcc-10.1.0-r2 and a znver3 CPU (5950X) but
> I am not sure it's the exact same issue as the internal compiler error
> happens at a different point.
> 
> so it doesn't seem to be related to -march. I have never encountered this
> issue before, with the same flags. Maybe it's related to bug #723738 I will
> try a -j1 build.

Your crash happens in a different file:

In file included from /var/tmp/portage/sys-devel/gcc-11.1.0-r2/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/regex:61,
                 from /var/tmp/portage/sys-devel/gcc-11.1.0-r2/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/stdc++.h:110,
                 from /var/tmp/portage/sys-devel/gcc-11.1.0-r2/work/gcc-11.1.0/libstdc++-v3/include/precompiled/extc++.h:32:
/var/tmp/portage/sys-devel/gcc-11.1.0-r2/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/regex_scanner.h: In substitution of ‘template<class _U1, typename std::enable_if<_MoveCopyPair<true, _U1, char>(), bool>::type <anonymous> > constexpr std::pair<char, char>::pair(_U1&&, const char&) [with _U1 = char; typename std::enable_if<_MoveCopyPair<true, _U1, char>(), bool>::type <anonymous> = true]’:
/var/tmp/portage/sys-devel/gcc-11.1.0-r2/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/regex_scanner.h:186:7:   required from here
/var/tmp/portage/sys-devel/gcc-11.1.0-r2/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/regex_scanner.h:186:7: internal compiler error: in retrieve_specialization, at cp/pt.c:1247
  186 |       };
      |       ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions.
make[5]: *** [Makefile:1877: x86_64-pc-linux-gnu/bits/extc++.h.gch/O2g.gch] Error 1

I suggest you to file a separate bug.
Comment 12 Adel KARA SLIMANE 2021-07-09 17:52:45 UTC
Thank you for your feedback, I will file a different bug
Comment 13 Andreas K. Hüttel archtester gentoo-dev 2023-08-23 01:32:12 UTC
(In reply to Adel KARA SLIMANE from comment #12)
> Thank you for your feedback, I will file a different bug