Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 877269 - sys-devel/gcc-12.2.1_p20221008 fails on Via System (32bit) (ICE in cpu_indicator_init)
Summary: sys-devel/gcc-12.2.1_p20221008 fails on Via System (32bit) (ICE in cpu_indica...
Status: RESOLVED UPSTREAM
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: 2022-10-16 03:12 UTC by Thomas Capricelli
Modified: 2022-10-24 21:28 UTC (History)
2 users (show)

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


Attachments
build.log (build.log.bz2,40.52 KB, application/x-bzip)
2022-10-16 03:14 UTC, Thomas Capricelli
Details
/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/config.log (config.log,39.61 KB, text/x-log)
2022-10-16 03:14 UTC, Thomas Capricelli
Details
/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-build-logs.tar.bz2 (gcc-build-logs.tar.bz2,108.06 KB, application/x-bzip)
2022-10-16 03:20 UTC, Thomas Capricelli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Capricelli 2022-10-16 03:12:50 UTC
The important part seems to be:

checking whether ln -s works... yes
checking for i686-pc-linux-gnu-gcc... /tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/xgcc -B/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include   -fno-checking
checking for suffix of object files... configure: error: in `/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/i686-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
make[2]: *** [Makefile:19065: configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory '/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build'


I'm not sure which config.log they mean, i got a bunch:
chopin /tmp/portage/sys-devel/gcc-12.2.1_p20221008 # find -name config.log
./work/build/libcpp/config.log
./work/build/libcody/config.log
./work/build/intl/config.log
./work/build/gcc/config.log
./work/build/libdecnumber/config.log
./work/build/build-i686-pc-linux-gnu/libcpp/config.log
./work/build/build-i686-pc-linux-gnu/fixincludes/config.log
./work/build/build-i686-pc-linux-gnu/libiberty/config.log
./work/build/i686-pc-linux-gnu/libgcc/config.log
./work/build/lto-plugin/config.log
./work/build/config.log
./work/build/libbacktrace/config.log
./work/build/libiberty/config.log


Reproducible: Always
Comment 1 Thomas Capricelli 2022-10-16 03:14:23 UTC
Created attachment 824347 [details]
build.log
Comment 2 Thomas Capricelli 2022-10-16 03:14:38 UTC
Created attachment 824349 [details]
/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/config.log
Comment 3 Thomas Capricelli 2022-10-16 03:16:59 UTC
It's an old system. But gcc used to compile, until few years ago. Since then there was #777117, so i couldn't update gcc.

This problem doesn't seem related ("CET " doesn't appear in error messages as last year).



chopin /tmp/portage/sys-devel/gcc-12.2.1_p20221008 # cat /proc/cpuinfo 
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 9
model name      : VIA Nehemiah
stepping        : 3
cpu MHz         : 665.000
cache size      : 64 KB
fdiv_bug        : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu de pse tsc msr cx8 mtrr pge cmov mmx fxsr sse cpuid rng rng_en
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit mmio_unknown
bogomips        : 1333.33
clflush size    : 32
cache_alignment : 32
address sizes   : 32 bits physical, 32 bits virtual
power management:
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-16 03:18:58 UTC
I think need the libgcc config.log but it's easier if you upload the tarball the ebuild creates for you, as it's intended for this purpose.
Comment 5 Thomas Capricelli 2022-10-16 03:20:34 UTC
Created attachment 824351 [details]
/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-build-logs.tar.bz2
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-16 16:35:02 UTC
Oh dear.

configure:3792: checking for suffix of object files
configure:3814: /tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/xgcc -B/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include   -fno-checking -c -g -march=native -pipe -O2  conftest.c >&5
xgcc: internal compiler error: in cpu_indicator_init, at common/config/i386/cpuinfo.h:986
0x8087146 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, char**, diagnostic_t)
	???:0
0x8088190 internal_error(char const*, ...)
	???:0
0x80883c0 fancy_abort(char const*, int, char const*)
	???:0
0x8062127 cpu_indicator_init(__processor_model*, __processor_model2*, unsigned int*)
	???:0
0x8062d1f host_detect_local_cpu(int, char const**)
	???:0
0x8056228 eval_spec_function(char const*, char const*, char const*)
	???:0
0x805644c handle_spec_function(char const*, bool*, char const*)
	???:0
0x8055ab3 do_spec_1(char const*, int, char const*)
	???:0
0x8056f10 process_brace_body(char const*, char const*, char const*, int, int)
	???:0
0x8056d3b handle_braces(char const*)
	???:0
0x8055a7d do_spec_1(char const*, int, char const*)
	???:0
0x8055e9a do_spec_1(char const*, int, char const*)
	???:0
0x8056f10 process_brace_body(char const*, char const*, char const*, int, int)
	???:0
0x8056d3b handle_braces(char const*)
	???:0
0x8055a7d do_spec_1(char const*, int, char const*)
	???:0
0x80555e7 do_spec_1(char const*, int, char const*)
	???:0
0x8055e9a do_spec_1(char const*, int, char const*)
	???:0
0x8056f10 process_brace_body(char const*, char const*, char const*, int, int)
	???:0
0x8056d3b handle_braces(char const*)
	???:0
0x8055a7d do_spec_1(char const*, int, char const*)
	???:0
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.
configure:3818: $? = 4
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3832: error: in `/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/i686-pc-linux-gnu/libgcc':
configure:3834: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-16 16:36:41 UTC
Could you try follow https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-16 16:39:42 UTC
I'm a bit worried that your existing GCC might be broken, actually. It may have been the patch which was used before.
Comment 9 Thomas Capricelli 2022-10-16 17:11:12 UTC
(In reply to Sam James from comment #8)
> I'm a bit worried that your existing GCC might be broken, actually. It may
> have been the patch which was used before.

But it's not my gcc that segfaults, it's the (stage/boostrap) one, no ?

/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/xgcc
Comment 10 Thomas Capricelli 2022-10-16 17:14:40 UTC
(In reply to Sam James from comment #7)
> Could you try follow https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?

I dont have the sources anymore. I'll retry, but that will require time. Hopefully that was a spurious ram/heat stuff.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-16 18:10:57 UTC
(In reply to Thomas Capricelli from comment #9)
> (In reply to Sam James from comment #8)
> > I'm a bit worried that your existing GCC might be broken, actually. It may
> > have been the patch which was used before.
> 
> But it's not my gcc that segfaults, it's the (stage/boostrap) one, no ?
> 
> /tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/xgcc

oh right, I'd assumed it died very early on as for some stuff, the wrappers get used even if they're actually system copies, but you're right here, it does build-and-then-use xgcc.

Could you try with USE=vanilla?
Comment 12 Thomas Capricelli 2022-10-16 21:29:08 UTC
It fails with the same error (i think) when trying to emerge sys-devel/gcc-11.3.1_p20221007

It's in /tmp/portage/sys-devel/gcc-11.3.1_p20221007/work/build/i686-pc-linux-gnu/libgcc
There's a config.log from which i can find the bad command. And it's 100% reproducible if i type it:



chopin /tmp/portage/sys-devel/gcc-11.3.1_p20221007/work/build/i686-pc-linux-gnu/libgcc # /tmp/portage/sys-devel/gcc-11.3.1_p20221007/work/build/./gcc/xgcc -B/tmp/portage/sys-devel/gcc-11.3.1_p20221007/work/build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include   -fno-checking -c -g -march=native -pipe -O2  conftest.c
xgcc: internal compiler error: in cpu_indicator_init, at common/config/i386/cpuinfo.h:934
0x8084693 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, char**, diagnostic_t)
        ???:0
0x8085678 internal_error(char const*, ...)
        ???:0
0x80858a8 fancy_abort(char const*, int, char const*)
        ???:0
0x8061969 cpu_indicator_init(__processor_model*, __processor_model2*, unsigned int*)
        ???:0
0x806254b host_detect_local_cpu(int, char const**)
        ???:0
0x8055da1 eval_spec_function(char const*, char const*, char const*)
        ???:0
0x8055fc5 handle_spec_function(char const*, bool*, char const*)
        ???:0
0x805562c do_spec_1(char const*, int, char const*)
        ???:0
0x8056a89 process_brace_body(char const*, char const*, char const*, int, int)
        ???:0
0x80568b4 handle_braces(char const*)

(...)
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-16 21:32:04 UTC
Fantastic (I know it's bad, but it's good too). Does it happen with USE=vanilla?
Comment 14 Thomas Capricelli 2022-10-17 11:13:27 UTC
It gives exactly the same error with vanillla.

chopin ~ # USE=vanilla emerge  sys-devel/gcc -1
[ebuild  NS   ] sys-devel/gcc-12.2.1_p20221008 [9.3.0] USE="(cxx) hardened nls nptl (pie) sanitize (ssp) vanilla* -ada% (-cet) (-custom-cflags) -d -debug -doc (-fixed-point) -fortran -go -graphite -jit (-libssp) -lto (-multilib) -objc -objc++ -objc-gc -openmp (-pch) -pgo -systemtap -test -valgrind% -vtv* -zstd% (-altivec%)" 
(...)

I can still reproduce it with

cd /tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/i686-pc-linux-gnu/libgcc/

/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/xgcc -B/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include   -fno-checking -o conftest -g -march=native -pipe -O2   conftest.c
Comment 15 Thomas Capricelli 2022-10-17 18:22:13 UTC
The error message says: xgcc: internal compiler error: in cpu_indicator_init, at common/config/i386/cpuinfo.h:986


I guess it's /tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-12-20221008/gcc/common/config/i386/cpuinfo.h

Whose line 986 says:

  gcc_assert (cpu_model->__cpu_vendor < VENDOR_MAX);

But if you check the code in the function "cpu_indicator_init", i can't see any way that __cpu_vendor is not within range.


If i isolate this code and compile it, it works (the assert doesn't raise). If i printf cpu_model->__cpu_vendor, i got 4, which is expected (VENDOR_CENTAUR).

So, globally.. i'm still lost :-(
Comment 16 Thomas Capricelli 2022-10-20 02:24:39 UTC
For the record, we suspected the current gcc (9.3.0) to be kinda corrupted. So i have

* installed a recent stage3/i686 in a directory on my local computer, chrooted and  created a package for gcc with quickpkg
* i scp it and installed gcc-11.3.0-1.xpak on the target
* carefully did gcc config/source and even restarted ssh connection
* tried to compile sys-devel/gcc-12.2.1_p20221008 with it

It fails at the same point, with same error (at the end). the line corresponds to 
  gcc_assert (cpu_model->__cpu_vendor < VENDOR_MAX);

But I can't see any valid code bath above that could give an invalid __cpu_vendor





--------------------------------------------------------------------------
xg++: internal compiler error: in cpu_indicator_init, at common/config/i386/cpuinfo.h:986
0x808790a diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, char**, diagnostic_t)
        ???:0
0x808894b internal_error(char const*, ...)
        ???:0
0x8088b7b fancy_abort(char const*, int, char const*)
        ???:0
0x80628c7 cpu_indicator_init(__processor_model*, __processor_model2*, unsigned int*)
        ???:0
Comment 17 Thomas Capricelli 2022-10-22 23:35:08 UTC
For the record, we've narrowed it to:

gcc-12 -Q -O2 -march=nehemiah --help=target -march=native # crashes
gcc-12 -Q -O2 -march=nehemiah --help=target # doesn't crash

Reproducible with gcc-11.3.0, but NOT with gcc-9.3.0 -> handles native without problem.

The error displayed being:

chopin /tmp # gcc-12 -Q -O2 -march=nehemiah --help=target -march=native
gcc-12: internal compiler error: in cpu_indicator_init, at common/config/i386/cpuinfo.h:986
0xb7c0235e __libc_start_main
        ???:0
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.
Comment 18 Thomas Capricelli 2022-10-23 10:49:05 UTC
I reported the bug upstream: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107364
Comment 19 Thomas Capricelli 2022-10-24 20:21:04 UTC
They are reactive, and they found very quickly. It's fixed and commited. I haven't validated yet (require a new gcc compile, very complicated here). But anyway, that's definitely upstream now.

Thanks a lot to Sam who helped me a lot, here and on IRC.