This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12315] New: stage1/cc1 segfaulted when --pg is used during bootstrap.
- From: "ishikawa at yk dot rim dot or dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2003 11:19:05 -0000
- Subject: [Bug c/12315] New: stage1/cc1 segfaulted when --pg is used during bootstrap.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12315
Summary: stage1/cc1 segfaulted when --pg is used during
bootstrap.
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ishikawa at yk dot rim dot or dot jp
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
During bootstrap, stage1/cc1 segfaulted.
(The bug seems triggered because I am trying to build
a C compiler with -pg, gprof feature. Not many people seem
to use gprof feature of the C compiler, I am afraid, and thus it
probably is not
exercised much.)
I hope this gets fixed soon.
========================================
THE BUG:
----------------------------------------
stage1/xgcc -Bstage1/ -B/usr/local/i686-pc-linux-gnu/bin/ -c -march=athlon-xp
-mtune=athlon-xp -g -pg -O2 -DIN_GCC -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Werror
-fno-common -DHAVE_CONFIG_H -I. -I. -I/u2/tools/gcc-mainline-cvs/gcc/gcc
-I/u2/tools/gcc-mainline-cvs/gcc/gcc/.
-I/u2/tools/gcc-mainline-cvs/gcc/gcc/../include
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c -o cppexp.o
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c: In function `num_trim':
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c:1014: internal compiler error:
Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [cppexp.o] Error 1
make[2]: Leaving directory `/u2/tools/gcc-mainline-obj-dir/gcc'
make[1]: *** [stage2_build] Error 2
make[1]: Leaving directory `/u2/tools/gcc-mainline-obj-dir/gcc'
make: *** [bootstrap] Error 2
========================================
Quote from GDB session:
----------------------------------------
I checked the value of svrtx using gdb, and
found that it is 0 (NULL) and GET_CODE(svrtx) is called.
ishikawa@duron$ stage1/cc1 -quiet -v -I. -I.
-I/u2/tools/gcc-mainline-cvs/gcc/gcc -I/u2/tools/gcc-mainline-cvs/gcc/gcc/.
-I/u2/tools/gcc-mainline-cvs/gcc/gcc/../include -iprefix
/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/
-isystem include -isystem stage1/include -isystem
/usr/local/i686-pc-linux-gnu/bin/include -DIN_GCC -DHAVE_CONFIG_H
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c -quiet -dumpbase cppexp.c
-march=athlon-xp -mtune=athlon-xp -auxbase-strip cppexp.o -g -O2 -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic
-Wno-long-long -Werror -version -p -fno-common -o /tmp/ccTCMJqs.s
ignoring nonexistent directory "stage1/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/bin/include"
ignoring nonexistent directory
"/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/include"
ignoring nonexistent directory
"/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include"
ignoring nonexistent directory "/usr/local/lib/../i686-pc-linux-gnu/include"
ignoring duplicate directory "."
ignoring duplicate directory "/u2/tools/gcc-mainline-cvs/gcc/gcc/."
#include "..." search starts here:
#include <...> search starts here:
.
/u2/tools/gcc-mainline-cvs/gcc/gcc
/u2/tools/gcc-mainline-cvs/gcc/gcc/../include
include
/usr/local/include
/usr/include
End of search list.
GNU C version 3.4 20030916 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c: In function `num_trim':
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c:1014: internal compiler error:
Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
ishikawa@duron$ gdb stage1/cc1
GNU gdb 5.3-debian
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-linux"...
Breakpoint 1 at 0x814f12c: file /u2/tools/gcc-mainline-cvs/gcc/gcc/diagnostic.c,
line 593.
Breakpoint 2 at 0x8049804
Breakpoint 3 at 0x80495a4
(gdb) run -quiet -v -I. -I. -I/u2/tools/gcc-mainline-cvs/gcc/gcc
-I/u2/tools/gcc-mainline-cvs/gcc/gcc/.
-I/u2/tools/gcc-mainline-cvs/gcc/gcc/../include -iprefix
/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/
-isystem include -isystem stage1/include -isystem
/usr/local/i686-pc-linux-gnu/bin/include -DIN_GCC -DHAVE_CONFIG_H
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c -quiet -dumpbase cppexp.c
-march=athlon-xp -mtune=athlon-xp -auxbase-strip cppexp.o -g -O2 -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic
-Wno-long-long -Werror -version -p -fno-common -o /tmp/ccTCMJqs.s
Starting program: /u2/tools/gcc-mainline-obj-dir/gcc/stage1/cc1 -quiet -v -I.
-I. -I/u2/tools/gcc-mainline-cvs/gcc/gcc -I/u2/tools/gcc-mainline-cvs/gcc/gcc/.
-I/u2/tools/gcc-mainline-cvs/gcc/gcc/../include -iprefix
/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/
-isystem include -isystem stage1/include -isystem
/usr/local/i686-pc-linux-gnu/bin/include -DIN_GCC -DHAVE_CONFIG_H
/u2/tools/gcc-mainline-cvs/gcc/gcc/cppexp.c -quiet -dumpbase cppexp.c
-march=athlon-xp -mtune=athlon-xp -auxbase-strip cppexp.o -g -O2 -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic
-Wno-long-long -Werror -version -p -fno-common -o /tmp/ccTCMJqs.s
Breakpoint 2 at 0x4004b81e
Breakpoint 3 at 0x4004a8c0
ignoring nonexistent directory "stage1/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/bin/include"
ignoring nonexistent directory
"/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/include"
ignoring nonexistent directory
"/u2/tools/gcc-mainline-obj-dir/gcc/stage1/../lib/gcc/i686-pc-linux-gnu/3.4/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include"
ignoring nonexistent directory "/usr/local/lib/../i686-pc-linux-gnu/include"
ignoring duplicate directory "."
ignoring duplicate directory "/u2/tools/gcc-mainline-cvs/gcc/gcc/."
#include "..." search starts here:
#include <...> search starts here:
.
/u2/tools/gcc-mainline-cvs/gcc/gcc
/u2/tools/gcc-mainline-cvs/gcc/gcc/../include
include
/usr/local/include
/usr/include
End of search list.
GNU C version 3.4 20030916 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Program received signal SIGSEGV, Segmentation fault.
0x081c67b5 in profile_function (file=0x86660a0)
at /u2/tools/gcc-mainline-cvs/gcc/gcc/final.c:1440
1440 if (sval && GET_CODE (svrtx) == REG)
(gdb) list
1435 }
1436
1437 function_section (current_function_decl);
1438
1439 #if defined(ASM_OUTPUT_REG_PUSH)
1440 if (sval && GET_CODE (svrtx) == REG)
1441 ASM_OUTPUT_REG_PUSH (file, REGNO (svrtx));
1442 #endif
1443
1444 #if defined(STATIC_CHAIN_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
(gdb) print sval
$1 = 1
(gdb) print svrtx
$2 = 0x0
(gdb) quit
A debugging session is active.
Do you still want to close the debugger?(y or n) y
ishikawa@duron$
cf.
Quote from "pr -n cppexp.c":
995 /* Clears the unused high order bits of the number pointed to by PNUM. */
996 static cpp_num
997 num_trim (cpp_num num, size_t precision)
998 {
999 if (precision > PART_PRECISION)
1000 {
1001 precision -= PART_PRECISION;
1002 if (precision < PART_PRECISION)
1003 num.high &= ((cpp_num_part) 1 << precision) - 1;
1004 }
1005 else
1006 {
1007 if (precision < PART_PRECISION)
1008 num.low &= ((cpp_num_part) 1 << precision) - 1;
1009 num.high = 0;
1010 }
1011
1012 return num;
1013 }
1014
This is how I configured GCC for bootstrap.
(I updated my local source CVS tree a few hours ago.)
:
#
set -vx
LANG=C
LC_ALL=C
export LANG
export LC_ALL
make distclean clean
rm config.cache
#
#--enable-languages=c
#
# Use absolute pathnaes
# env CC=gcc-cvs
#
env CC=gcc /u2/tools/gcc-mainline-cvs/gcc/configure \
--enable-languages=c,c++,objc \
--program-suffix=-mainline-cvs --enable-nls
#
#env CC=gcc-cvs make BOOT_CFLAGS="-g -pg -O2 -ftest-coverage -fprofile-arcs"
bootstrap
# doesn't work
#
env CC="gcc" make BOOT_CFLAGS="-march=athlon-xp -mtune=athlon-xp -g -pg -O2 "
bootstrap
# bootstrap-lean