gcc7 can't compile float type after I change the ubuntu 18.04's hardware (include cpu and motherboard), even I reinstall gcc7 and build-essential etc packages. cross build like arm-linux-gnueabihf-gcc failed too. but clang is work fine at that time.
Before:
CPU: i7-8700k,
Code Name: Coffee Lake
Motherboard: ASUS prime z370A https://www.asus.com/Motherboards-Components/Motherboards/PRIME/PRIME-Z370-A/
After:
CPU: i7-4770K
Code Name: haswell
Motherboard: ASUS Z87-DELUXE https://www.asus.com/SupportOnly/Z87DELUXE/HelpDesk_Manual/
more details:
cat a.c
int main()
{
float a=10000.0;
return a/111;
}
gcc -c a.c
a.c: In function ‘main’:
a.c:29:5: internal compiler error: Illegal instruction
float a=10000.0;
^~~~~
I try to debug it:
>gcc -O0 -c a.c -wrapper gdb,--args
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
...
Reading symbols from /usr/lib/gcc/x86_64-linux-gnu/7/cc1...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/lib/gcc/x86_64-linux-gnu/7/cc1 -quiet -imultiarch x86_64-linux-gnu a.c -quiet -dumpbase a.c -mtune=generic -march=x86-64 -auxbase a -O0 -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccWQLBBi.s
Program received signal SIGILL, Illegal instruction.
0x00007ffff736cd42 in __gmpn_mul_basecase () from /usr/local/lib/libgmp.so.10
(gdb) bt
#0 0x00007ffff736cd42 in __gmpn_mul_basecase () from /usr/local/lib/libgmp.so.10
#1 0xffffffffffffff01 in ?? ()
#2 0x00007fffffffcc70 in ?? ()
#3 0x00007fffffffcc60 in ?? ()
#4 0x0000000000000004 in ?? ()
#5 0x00007ffff736c7a6 in __gmpn_mul_n () from /usr/local/lib/libgmp.so.10
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
It seems failed with libgmp.so.10, so I reinstall libgmp10 package, but it still failed with same issue.
All gcc version not work, gcc 7,8,9 and cross version for mips/powerpc, but gcc work fine if run in docker.
I update system to 20.04.4 now by system upgrade, its still not work.
I guess the libgmp detect wrong CPU type when calling.