http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54719
Bug #: 54719
Summary: Bootstrap stuck in stage1 with message "checking for
compiler with PCH support"
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
AssignedTo: [email protected]
ReportedBy: [email protected]
Bootstrap fails when running with MALLOC_CHECK_=3. The
configure (actually config.log) of stage 1 in
x86_64-unknown-linux-gnu/libstdc++-v3 says:
configure:15104: checking for compiler with PCH support
And it gets stuck there for ever.
It seems like the PCH support is broken somehow. To reproduce:
$ cat conftest.h:
-------->8<------
extern int foo();
-------->8<------
$ cat conftest.cc:
-------->8<------
#include "conftest.h"
-------->8<------
$ export MALLOC_CHECK_=3
$ cc1plus -quiet conftest.h --output-pch=conftest.h.gch
$ cc1plus -quiet conftest.cc
The last command hangs for ever.
gdb says:
Program received signal SIGSEGV, Segmentation fault.
0x000000306e07a30a in mem2chunk_check () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.15-56.fc17.x86_64
gmp-5.0.2-6.fc17.x86_64 libgcc-4.7.0-5.fc17.x86_64 libmpc-0.9-2.fc17.2.x86_64
libstdc++-4.7.0-5.fc17.x86_64 mpfr-3.1.0-2.fc17.x86_64
(gdb) bt
#0 0x000000306e07a30a in mem2chunk_check () from /lib64/libc.so.6
#1 0x000000306e07e276 in free_check () from /lib64/libc.so.6
#2 0x0000000001238d31 in location_adhoc_data_fini (set=0x1000176000)
at /home/dodji/devel/git/gcc/bootstrap/libcpp/line-map.c:164
#3 0x0000000000bcc803 in toplev_main (argc=4, argv=0x7fffffffe398)
at /home/dodji/devel/git/gcc/bootstrap/gcc/toplev.c:1949
#4 0x000000000120b348 in main (argc=4, argv=0x7fffffffe398)
at /home/dodji/devel/git/gcc/bootstrap/gcc/main.c:36
(gdb)
The issues is that after loading the pch file, toplev_main invokes
location_adhoc_data_fini which tries to free stuff in the
location_adhoc_data_map member of the instance of line_maps. But
these pointers have been 're-set' by the loading the pch file, in
c_common_write_pch, AFAIU. And that triggers a sigsev, and then the
process hangs.
If that data is to be saved to disk as part of the PCH, why isn't it
allocated in GCC memory?
The other issue I don't quite understand is, why is the process
hanging instead of just exiting after the sigsev?