Created attachment 598282 [details] build log the compiler throws an "internal compiler error" and the package fails to emerge
Created attachment 598284 [details] emerge information
The underlying failure is: /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/d/runtime.cc:37:6: warning: type 'libcall_type' violates the C++ One Definition Rule [-Wodr] 37 | enum libcall_type | ^ /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/rtl.h:4108:6: note: an enum with different value name is defined in another translation unit 4108 | enum libcall_type | ^ during RTL pass: ira /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/vec.h: In function 'reserve': /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/vec.h:385: internal compiler error: in to_frequency, at profile-count.c:265 385 | } | Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.gentoo.org/> for instructions. 1. Do you encounter the same error if you attempt to built gcc again? 2. Does 'dmesg' say if crash happened due to OOM? (unlikely, but just in casee)
If it still happens prease reopen with details requested in #comment2
the error is still happening but there is no OOM crash on dmesg. Also, this bug happens on the very end of compilation. Counting from genlop, it was less then 30min to end. Sorry for the late answer, I was having some other minor problem with world update at the same time. I have a memory compressor at the kernel, I dont know if it could be an issue for the profiler
Do you encounter the same error if you attempt to built gcc again? Can you upload more recent build failure?
Created attachment 617138 [details] latest build log
I have tried it just before reopening
Created attachment 617140 [details] values on /etc/portage/env/gcc.conf
Yeah, looks like the bug is deterministic: """ 37 | enum libcall_type | ^ /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/rtl.h:4108:6: note: an enum with different value name is defined in another translation unit 4108 | enum libcall_type | ^ during RTL pass: ira /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/vec.h: In function ‘reserve’: /var/tmp/portage/sys-devel/gcc-9.2.0-r2/work/gcc-9.2.0/gcc/vec.h:385: internal compiler error: in to_frequency, at profile-count.c:265 385 | } | Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.gentoo.org/> for instructions. """
Reproduced locally. Looking at the details.
Seems to be with USE="lto pgo d" specifically.
In my case it is USE=-d: """ [ebuild R ] sys-devel/gcc-9.2.0-r2:9.2.0::gentoo USE="(cxx) fortran lto* (multilib) nls nptl openmp pch pgo* (pie) sanitize ssp vtv (-altivec) -d -debug -doc (-fixed-point) -go -graphite (-hardened) (-jit) (-libssp) -objc -objc++ -objc-gc -systemtap -test -vanilla" 0 KiB """
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3bbf3bd432ec1436bef6e2d7ffc83d1c031553ab commit 3bbf3bd432ec1436bef6e2d7ffc83d1c031553ab Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-03-05 23:52:26 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-03-05 23:52:26 +0000 toolchain.eclass: mangle -O3 down to -O2, not -O0 In bug #701786 'strip-flags' removed all unsafe options first including -O3 and only then mangled -O? to -O2. This effectively made gcc to compalie wth -O0, generated huge slow profile and confused LTO. Let's default to safer -O3->-O2 transition. Reported-by: jeff.lemos.a@gmail.com Closes: https://bugs.gentoo.org/701786 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(In reply to jeff.lemos.a from comment #8) > Created attachment 617140 [details] > values on /etc/portage/env/gcc.conf Also dounble-check your quoting at: BOOT_CFLAGS='${BOOT_CFLAGS} --param lto-max-streaming-parallelism=3 -pipe -march=native' CFLAGS_FOR_TARGET='${CFLAGS_FOR_TARGET} --param lto-max-streaming-parallelism=3 -pipe -march=native' I suspect you lose all optimisations here as well.
https://gcc.gnu.org/PR97295 will fix handling of -O3/-O0+LTO+PGO case in gcc.