This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/12315] [3.4 Regression] 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: 20 Sep 2003 18:03:48 -0000
- Subject: [Bug other/12315] [3.4 Regression] stage1/cc1 segfaulted when --pg is used during bootstrap.
- References: <20030917111856.12315.ishikawa@yk.rim.or.jp>
- 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
------- Additional Comments From ishikawa at yk dot rim dot or dot jp 2003-09-20 18:03 -------
Hi,
The way I see it, the bug seems triggered when
a function that returns a struct value is
profiled.
(I think that
either the register that holds the hidden pointer to the area
reserved for the return value [ passed from
the caller], or a register that holds the small struct value that
fits in a register [to be returned thus in a register]
is forced out of the way for profiling code when
this ASM_OUTPUT_REG_PUSH is called.
However, I wonder what happens if ASM_OUTPUT_REG_PUSH is NOT
defined. What happens on such architecture WITHOUT
ASM_OUTPUT_REG_PUSH if we specify profiling?)
The above observation might be obvious to you already, though.
BTW, a simple file below, which includes
functions that return struct values, causes stage1/cc1 to segfault
in a very similar manner as observed during bootstrap.
Looking at the generated asm output (by not adding -pg ) of this test file
might reveal some insight.
Test code: gcc-problem.c
Attached.
segfault example:
stage1/cc1 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0
/home/ishikawa/BUG-DIR/GCC-BUG/gcc-problem.c -quiet -dumpbase gcc-problem.c
-auxbase gcc-problem -version -p -o /tmp/ccrvPYue.s
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"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include
End of search list.
GNU C version 3.4 20030919 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
/home/ishikawa/BUG-DIR/GCC-BUG/gcc-problem.c: In function `testfuncwordsimple2':
/home/ishikawa/BUG-DIR/GCC-BUG/gcc-problem.c:24: 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$
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 0x814f5c4: file /u2/tools/gcc-mainline-cvs/gcc/gcc/diagnostic.c,
line 593.
Breakpoint 2 at 0x8049804
Breakpoint 3 at 0x80495a4
(gdb) run -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0
/home/ishikawa/BUG-DIR/GCC-BUG/gcc-problem.c -quiet -dumpbase gcc-problem.c
-auxbase gcc-problem -version -p -o /tmp/ccrvPYue.s
Starting program: /u2/tools/gcc-mainline-obj-dir/gcc/stage1/cc1 -quiet -v
-D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0
/home/ishikawa/BUG-DIR/GCC-BUG/gcc-problem.c -quiet -dumpbase gcc-problem.c
-auxbase gcc-problem -version -p -o /tmp/ccrvPYue.s
Breakpoint 2 at 0x4004b81e
Breakpoint 3 at 0x4004a8c0
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"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include
End of search list.
GNU C version 3.4 20030919 (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.
0x081c6675 in profile_function (file=0x86592f0)
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) print current_function_decl
$3 = 0x40198dec
(gdb) print file
$4 = (FILE *) 0x86592f0
(gdb) quit
A debu
The file gcc-problem.c is attached as the next post.