This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/47243] New: [4.6 Regression] Bootstrap fails: Segfault of genmddeps / COLLECT bug?
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Jan 2011 15:52:01 +0000
- Subject: [Bug bootstrap/47243] New: [4.6 Regression] Bootstrap fails: Segfault of genmddeps / COLLECT bug?
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47243
Summary: [4.6 Regression] Bootstrap fails: Segfault of
genmddeps / COLLECT bug?
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
As mentioned by me at http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00439.html,
I get the following segfault during building Stage 2:
Starting program: /projects/tob/gcc-git/gcc-build/gcc/build/genmddeps
/projects/tob/gcc-git/gcc/gcc/config/i386/i386.md
Program received signal SIGSEGV, Segmentation fault.
(gdb) run
Starting program: /projects/tob/gcc-git/gcc-build/gcc/build/genmddeps
Breakpoint 5, handle_toplevel_file (handle_directive=0) at
/home/tob/projects/gcc-git/gcc/gcc/read-md.c:991
991 lastsl = strrchr (in_fname, '/');
(gdb) ptype lastsl
type = char *
(gdb) ptype in_fname
type = const char *
(gdb) p in_fname
$1 = 0x4054c9 "<stdin>"
(gdb) p strrchr
$2 = -831647898
(gdb) s
Program received signal SIGSEGV, Segmentation fault.
0x0000000000407510 in strrchr ()
* * *
Test case:
#include <string.h>
const char *read_md_filename;
const char *in_fname;
int
main ()
{
char *resstr;
read_md_filename = "<stdin>";
in_fname = read_md_filename;
resstr = strrchr (in_fname, '/');
return 0;
}
Compiling and linking with the system compiler works:
$ gcc -c -g foo.c
$ gcc foo.o
$ ./a.out
But if I link with the stage 2 compiler, it fails:
$ /home/tob/projects/gcc-git/gcc-build/./prev-gcc/collect2 -plugin
/home/tob/projects/gcc-git/gcc-build/./prev-gcc/liblto_plugin.so
-plugin-opt=/home/tob/projects/gcc-git/gcc-build/./prev-gcc/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc5dUxER.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/home/tob/projects/gcc-git/gcc-build/./prev-gcc/crtbegin.o
-L/home/tob/projects/gcc-git/gcc-build/./prev-gcc -L/lib/../lib64
-L/usr/lib/../lib64 foo.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/home/tob/projects/gcc-git/gcc-build/./prev-gcc/crtend.o
/usr/lib/../lib64/crtn.o
$ ./a.out
Segmentation fault (core dumped)