This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/70136] New: -march=native causes SIGABRT due to double close of FILE on certain ARM systems (BCM2834, armv8 cortex-a53)
- From: "andrewm.roberts at sky dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 08 Mar 2016 08:39:28 +0000
- Subject: [Bug c/70136] New: -march=native causes SIGABRT due to double close of FILE on certain ARM systems (BCM2834, armv8 cortex-a53)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70136
Bug ID: 70136
Summary: -march=native causes SIGABRT due to double close of
FILE on certain ARM systems (BCM2834, armv8
cortex-a53)
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: andrewm.roberts at sky dot com
Target Milestone: ---
gcc 4.9.1 (Raspbian Linux)
gcc 5.3.0 (Arch Linux)
gcc 6-20160306 (Arch Linux)
all crash on Raspberry Pi 3 (BCM2834, armv8 cortex-a53) when using
-march=native compiler flag.
To reproduce:
echo "int main(void) {return0;}" | gcc -c -x c -march=native -
Example output (gcc 5.3.0):
[alarm@alarmp ~]$ echo "int main(void) {return 0;}" | gcc -c -x c -march=native
-
*** Error in `gcc': double free or corruption (!prev): 0x016486d8 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x649a4)[0x76e399a4]
/usr/lib/libc.so.6(+0x6ad2c)[0x76e3fd2c]
/usr/lib/libc.so.6(+0x6b6bc)[0x76e406bc]
/usr/lib/libc.so.6(fclose+0x110)[0x76e2f118]
gcc[0x20898]
gcc[0x1da3c]
gcc[0x1bfb4]
gcc[0x1e484]
gcc[0x1c6a0]
gcc[0x1d4c8]
gcc[0x1e808]
gcc[0x1ed08]
gcc[0x127a0]
gcc[0x12834]
/usr/lib/libc.so.6(__libc_start_main+0x114)[0x76debcf8]
======= Memory map: ========
00010000-000b9000 r-xp 00000000 b3:02 1201092 /usr/bin/gcc
000c8000-000ca000 rw-p 000a8000 b3:02 1201092 /usr/bin/gcc
000ca000-000cc000 rw-p 00000000 00:00 0
01640000-01665000 rw-p 00000000 00:00 0 [heap]
76b00000-76b21000 rw-p 00000000 00:00 0
76b21000-76c00000 ---p 00000000 00:00 0
76c06000-76c22000 r-xp 00000000 b3:02 1198730 /usr/lib/libgcc_s.so.1
76c22000-76c32000 ---p 0001c000 b3:02 1198730 /usr/lib/libgcc_s.so.1
76c32000-76c33000 rw-p 0001c000 b3:02 1198730 /usr/lib/libgcc_s.so.1
76c3d000-76dd5000 r--p 00000000 b3:02 1317130 /usr/lib/locale/locale-archive
76dd5000-76efc000 r-xp 00000000 b3:02 1198747 /usr/lib/libc-2.23.so
76efc000-76f0c000 ---p 00127000 b3:02 1198747 /usr/lib/libc-2.23.so
76f0c000-76f0e000 r--p 00127000 b3:02 1198747 /usr/lib/libc-2.23.so
76f0e000-76f0f000 rw-p 00129000 b3:02 1198747 /usr/lib/libc-2.23.so
76f0f000-76f12000 rw-p 00000000 00:00 0
76f12000-76f82000 r-xp 00000000 b3:02 1198805 /usr/lib/libm-2.23.so
76f82000-76f91000 ---p 00070000 b3:02 1198805 /usr/lib/libm-2.23.so
76f91000-76f92000 r--p 0006f000 b3:02 1198805 /usr/lib/libm-2.23.so
76f92000-76f93000 rw-p 00070000 b3:02 1198805 /usr/lib/libm-2.23.so
76f93000-76fb3000 r-xp 00000000 b3:02 1198581 /usr/lib/ld-2.23.so
76fb6000-76fb7000 rw-p 00000000 00:00 0
76fc0000-76fc2000 rw-p 00000000 00:00 0
76fc2000-76fc3000 r--p 0001f000 b3:02 1198581 /usr/lib/ld-2.23.so
76fc3000-76fc4000 rw-p 00020000 b3:02 1198581 /usr/lib/ld-2.23.so
7e828000-7e849000 rw-p 00000000 00:00 0 [stack]
7eede000-7eedf000 r-xp 00000000 00:00 0 [sigpage]
7eedf000-7eee0000 r--p 00000000 00:00 0 [vvar]
7eee0000-7eee1000 r-xp 00000000 00:00 0 [vdso]
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]
Aborted (core dumped)
Reproduced on:
Arch Linux Arm for Raspberry Pi 3
uname -a
Linux alarmpi 4.1.19-2-ARCH #1 SMP Sat Mar 5 22:22:01 MST 2016 armv7l GNU/Linux
cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 76.80
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 1
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 76.80
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 2
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 76.80
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 3
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 76.80
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
Hardware : BCM2709
Revision : a02082
Serial : 00000000xxxxxxxx
Host Compiler:
[alarm@alarmpi ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.3.0/lto-wrapper
Target: armv7l-unknown-linux-gnueabihf
Configured with: /build/gcc/src/gcc-5-20160209/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info
--with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues
--enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf
--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
Thread model: posix
gcc version 5.3.0 (GCC)
Also tested with gcc-6-20160306
[alarm@alarmpi ~]$ /usr/local/gcc-6.0.0/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-6.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-6.0.0/libexec/gcc/armv7l-unknown-linux-gnueabihf/6.0.0/lto-wrapper
Target: armv7l-unknown-linux-gnueabihf
Configured with: ../gcc-6.0.0/configure --prefix=/usr/local/gcc-6.0.0
--enable-languages=c,c++,fortran --enable-shared --enable-threads=posix
--with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf
--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
--target=armv7l-unknown-linux-gnueabihf --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160306 (experimental) (GCC)
built gcc 6.0.0 with "-O0 -g"
using intree: mfpr-3.1.4, isl-0.16.1, gmp-6.1.0, mpc-1.0.3
( NOTE 2 GCC BUILD BUGS HERE
1) had to run autoreconf on isl it wanted automake 1.14.1 and wouldn't build
with automake 1.15. This is the isl from gcc infrastructure page.
2) after configure had to fix makefile in gcc due to bug, as mentioned here:
https://sourceware.org/bugzilla/attachment.cgi?id=6807
# Workaround for a problem introduced with GMP 5.1.0.
# If configured by gcc with the "none" host & target, it will result in
undefined references to '__gmpn_invert_limb' during linking.
# Should be fixed by next version of gcc, but let me know if you have any more
ideas on this.
)
cd gcc-6.0.0/isl
autoreconf
cd ..
cd gcc-build
../gcc-6.0.0/configure ... (see above)
sed -i 's/none-/armv7l-/' Makefile
make
make install
using host binutils:
[alarm@alarmpi gcc]$ ld -v
GNU ld (GNU Binutils) 2.26.0.20160302
Stack trace points to:
[alarm@alarmpi ~]$ gdb --args /usr/local/gcc-6.0.0/bin/gcc -march=native -c
tmp.c
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/gcc-6.0.0/bin/gcc...done.
(gdb) run
Starting program: /usr/local/gcc-6.0.0/bin/gcc -march=native -c tmp.c
*** Error in `/usr/local/gcc-6.0.0/bin/gcc': double free or corruption (!prev):
0x00130ff0 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x649a4)[0x76e759a4]
/usr/lib/libc.so.6(+0x6ad2c)[0x76e7bd2c]
/usr/lib/libc.so.6(+0x6b6bc)[0x76e7c6bc]
/usr/lib/libc.so.6(fclose+0x110)[0x76e6b118]
/usr/local/gcc-6.0.0/bin/gcc[0x2d690]
/usr/local/gcc-6.0.0/bin/gcc[0x1ef48]
/usr/local/gcc-6.0.0/bin/gcc[0x1f290]
/usr/local/gcc-6.0.0/bin/gcc[0x1e654]
/usr/local/gcc-6.0.0/bin/gcc[0x20168]
/usr/local/gcc-6.0.0/bin/gcc[0x1fed4]
/usr/local/gcc-6.0.0/bin/gcc[0x1e630]
/usr/local/gcc-6.0.0/bin/gcc[0x1b474]
/usr/local/gcc-6.0.0/bin/gcc[0x1b6d0]
/usr/local/gcc-6.0.0/bin/gcc[0x23558]
/usr/local/gcc-6.0.0/bin/gcc[0x22318]
/usr/local/gcc-6.0.0/bin/gcc[0x2caa8]
/usr/lib/libc.so.6(__libc_start_main+0x114)[0x76e27cf8]
======= Memory map: ========
00010000-00106000 r-xp 00000000 b3:02 1214991 /usr/local/gcc-6.0.0/bin/gcc
00115000-00117000 rw-p 000f5000 b3:02 1214991 /usr/local/gcc-6.0.0/bin/gcc
00117000-0013a000 rw-p 00000000 00:00 0 [heap]
76b00000-76b21000 rw-p 00000000 00:00 0
76b21000-76c00000 ---p 00000000 00:00 0
76c42000-76c5e000 r-xp 00000000 b3:02 1198730 /usr/lib/libgcc_s.so.1
76c5e000-76c6e000 ---p 0001c000 b3:02 1198730 /usr/lib/libgcc_s.so.1
76c6e000-76c6f000 rw-p 0001c000 b3:02 1198730 /usr/lib/libgcc_s.so.1
76c79000-76e11000 r--p 00000000 b3:02 1317130 /usr/lib/locale/locale-archive
76e11000-76f38000 r-xp 00000000 b3:02 1198747 /usr/lib/libc-2.23.so
76f38000-76f48000 ---p 00127000 b3:02 1198747 /usr/lib/libc-2.23.so
76f48000-76f4a000 r--p 00127000 b3:02 1198747 /usr/lib/libc-2.23.so
76f4a000-76f4b000 rw-p 00129000 b3:02 1198747 /usr/lib/libc-2.23.so
76f4b000-76f4e000 rw-p 00000000 00:00 0
76f4e000-76fbe000 r-xp 00000000 b3:02 1198805 /usr/lib/libm-2.23.so
76fbe000-76fcd000 ---p 00070000 b3:02 1198805 /usr/lib/libm-2.23.so
76fcd000-76fce000 r--p 0006f000 b3:02 1198805 /usr/lib/libm-2.23.so
76fce000-76fcf000 rw-p 00070000 b3:02 1198805 /usr/lib/libm-2.23.so
76fcf000-76fef000 r-xp 00000000 b3:02 1198581 /usr/lib/ld-2.23.so
76fef000-76ff0000 rw-p 00000000 00:00 0
76ff9000-76ffb000 rw-p 00000000 00:00 0
76ffb000-76ffc000 r-xp 00000000 00:00 0 [sigpage]
76ffc000-76ffd000 r--p 00000000 00:00 0 [vvar]
76ffd000-76ffe000 r-xp 00000000 00:00 0 [vdso]
76ffe000-76fff000 r--p 0001f000 b3:02 1198581 /usr/lib/ld-2.23.so
76fff000-77000000 rw-p 00020000 b3:02 1198581 /usr/lib/ld-2.23.so
7efdf000-7f000000 rw-p 00000000 00:00 0 [stack]
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]
Program received signal SIGABRT, Aborted.
0x76e3c840 in raise () from /usr/lib/libc.so.6
(gdb) up
#1 0x76e3dbe0 in abort () from /usr/lib/libc.so.6
(gdb) up
#2 0x76e759a8 in __libc_message () from /usr/lib/libc.so.6
(gdb) up
#3 0x76e7bd2c in malloc_printerr () from /usr/lib/libc.so.6
(gdb) up
#4 0x76e7c6bc in _int_free () from /usr/lib/libc.so.6
(gdb) up
#5 0x76e6b118 in fclose@@GLIBC_2.4 () from /usr/lib/libc.so.6
(gdb) up
#6 0x0002d690 in host_detect_local_cpu (argc=1, argv=0x130928)
at ../../gcc-6.0.0/gcc/config/arm/driver-arm.c:145
145 fclose (f);
(gdb) print f
$1 = (FILE *) 0x130ff0
(gdb) quit
A debugging session is active.
Inferior 1 [process 7333] will be killed.
Quit anyway? (y or n) y