This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-finline-functions segmentation fault
- To: gcc at gcc dot gnu dot org
- Subject: -finline-functions segmentation fault
- From: Kurt Garloff <kurt at garloff dot de>
- Date: Thu, 14 Jun 2001 00:52:19 +0200
- Organization: TUE/NL, SuSE/FRG
Hi,
compiling heavily nested C++ code, I get a segmentation fault with a recent
gcc-3.0 (CVS). Without -finline-functions, everything is fine.
Note that opencoax.cc:229: is the last line of the file, containing };
Preprocessed input on request.
garloff@pckurt:~/Physics/numerix-2.0-gcc3/mpt/open_coax > gcc -O2
-finline-functions -Wall --save-temps -I../../lina/include -I../include
-DTYPE="double" -o opencoax.o -c opencoax.cc -fno-implicit-templates
opencoax.cc: In function int main(int, char**)':
opencoax.cc:168: warning: unused variable int l'
[gdb]
Program received signal SIGSEGV, Segmentation fault.
init_label_info (f=0x426697c0) at ../../gcc/jump.c:786
786 next = XEXP (note, 1);
(gdb) bt
#0 init_label_info (f=0x426697c0) at ../../gcc/jump.c:786
#1 0x816b747 in jump_optimize_1 (f=0x426697c0, cross_jump=0, noop_moves=0,
after_regscan=0, mark_labels_only=0, minimal=1) at ../../gcc/jump.c:212
#2 0x816b71c in jump_optimize_minimal (f=0x426697c0) at ../../gcc/jump.c:156
#3 0x80f8d05 in finish_eh_generation () at ../../gcc/except.c:2359
#4 0x80cba56 in rest_of_compilation (decl=0x410cdd00)
at ../../gcc/toplev.c:2936
#5 0x80b10ac in genrtl_finish_function (fn=0x410cdd00)
at ../../gcc/cp/semantics.c:2677
#6 0x80b0da6 in expand_body (fn=0x410cdd00) at ../../gcc/cp/semantics.c:2463
#7 0x8081a5d in finish_file () at ../../gcc/cp/decl2.c:3641
#8 0x80b00ba in finish_translation_unit () at ../../gcc/cp/semantics.c:1665
#9 0x808b4cd in yyparse_1 () at parse.y:441
#10 0x80c6d76 in yyparse () at ../../gcc/c-lex.c:158
#11 0x80cb06d in compile_file (name=0xbffff3b8 "opencoax.ii")
at ../../gcc/toplev.c:2369
#12 0x80cf08b in main (argc=12, argv=0xbffff16c) at ../../gcc/toplev.c:5000
#13 0x40039a8e in __libc_start_main (main=0x80ce8e0 <main>, argc=12,
argv=0xbffff16c, init=0x80490e8 <_init>, fini=0x826f244 <_fini>,
rtld_fini=0x4000aa50 <_dl_fini>, stack_end=0xbffff164)
at ../sysdeps/generic/libc-start.c:92
(gdb) l
781 {
782 rtx note, next;
783
784 for (note = REG_NOTES (insn); note; note = next)
785 {
786 next = XEXP (note, 1);
787 if (REG_NOTE_KIND (note) == REG_LABEL
788 && ! reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
789 remove_note (insn, note);
790 }
(gdb) p note
$1 = 0x34
(gdb) p *insn
$2 = {code = CALL_INSN, mode = VOIDmode, jump = 0, call = 0, unchanging = 0,
volatil = 0, in_struct = 0, used = 0, integrated = 0, frame_related = 0,
fld = {{rtwint = 130262, rtint = 130262, rtuint = 130262,
rtstr = 0x1fcd6 <Address 0x1fcd6 out of bounds>, rtx = 0x1fcd6,
rtvec = 0x1fcd6, rttype = 130262, rt_addr_diff_vec_flags = {
min_align = 214, base_after_vec = 0, min_after_vec = 0,
max_after_vec = 1, min_after_base = 1, max_after_base = 1,
offset_unsigned = 1, 3, scale = 1}, rt_cselib = 0x1fcd6,
rtbit = 0x1fcd6, rttree = 0x1fcd6, bb = 0x1fcd6}}}
(gdb) disass 0x816c493
Dump of assembler code for function init_label_info:
0x816c430 <init_label_info>: push %ebp
0x816c431 <init_label_info+1>: mov %esp,%ebp
0x816c433 <init_label_info+3>: sub $0xc,%esp
0x816c436 <init_label_info+6>: push %edi
0x816c437 <init_label_info+7>: push %esi
0x816c438 <init_label_info+8>: push %ebx
0x816c439 <init_label_info+9>: movl $0x0,0xfffffffc(%ebp)
0x816c440 <init_label_info+16>: mov 0x8(%ebp),%esi
0x816c443 <init_label_info+19>: test %esi,%esi
0x816c445 <init_label_info+21>: je 0x816c4dc <init_label_info+172>
0x816c44b <init_label_info+27>: nop
0x816c44c <init_label_info+28>: lea 0x0(%esi,1),%esi
0x816c450 <init_label_info+32>: mov (%esi),%ax
0x816c453 <init_label_info+35>: cmp $0x23,%ax
0x816c457 <init_label_info+39>: jne 0x816c470 <init_label_info+64>
0x816c459 <init_label_info+41>: testb $0x10,0x3(%esi)
0x816c45d <init_label_info+45>: setne %al
0x816c460 <init_label_info+48>: mov %eax,%edx
0x816c462 <init_label_info+50>: and $0x1,%edx
0x816c465 <init_label_info+53>: mov %edx,0x10(%esi)
0x816c468 <init_label_info+56>: jmp 0x816c4c6 <init_label_info+150>
0x816c46a <init_label_info+58>: lea 0x0(%esi),%esi
0x816c470 <init_label_info+64>: cmp $0x20,%ax
0x816c474 <init_label_info+68>: jne 0x816c480 <init_label_info+80>
0x816c476 <init_label_info+70>: movl $0x0,0x20(%esi)
0x816c47d <init_label_info+77>: jmp 0x816c4c6 <init_label_info+150>
0x816c47f <init_label_info+79>: nop
0x816c480 <init_label_info+80>: cmp $0x1f,%ax
0x816c484 <init_label_info+84>: je 0x816c48c <init_label_info+92>
0x816c486 <init_label_info+86>: cmp $0x21,%ax
0x816c48a <init_label_info+90>: jne 0x816c4c6 <init_label_info+150>
0x816c48c <init_label_info+92>: mov 0x1c(%esi),%ebx
0x816c48f <init_label_info+95>: test %ebx,%ebx
0x816c491 <init_label_info+97>: je 0x816c4c6 <init_label_info+150>
0x816c493 <init_label_info+99>: mov 0x8(%ebx),%edi
^^^^^^^^^
0x816c496 <init_label_info+102>: cmpb $0xd,0x2(%ebx)
0x816c49a <init_label_info+106>: jne 0x816c4c0 <init_label_info+144>
0x816c49c <init_label_info+108>: add $0xfffffff8,%esp
0x816c49f <init_label_info+111>: mov 0x10(%esi),%eax
0x816c4a2 <init_label_info+114>: push %eax
(gdb) info reg
eax 0x10021 65569
ecx 0x426697c0 1114019776
edx 0x0 0
ebx 0x34 52
esp 0xbfffe32c 0xbfffe32c
ebp 0xbfffe344 0xbfffe344
esi 0x42e1e380 1122100096
edi 0x34 52
eip 0x816c493 0x816c493
eflags 0x10202 66050
[...]
0x8(%ebx) is invalid, obviously. I guess %ebx and %edi contain note and next.
Breakpoint 1, init_label_info (f=0x426697c0) at ../../gcc/jump.c:786
786 next = XEXP (note, 1);
$18 = {code = CALL_INSN, mode = VOIDmode, jump = 0, call = 0, unchanging = 0,
volatil = 0, in_struct = 0, used = 0, integrated = 0, frame_related = 0,
fld = {{rtwint = 130262, rtint = 130262, rtuint = 130262,
rtstr = 0x1fcd6 <Address 0x1fcd6 out of bounds>, rtx = 0x1fcd6,
rtvec = 0x1fcd6, rttype = 130262, rt_addr_diff_vec_flags = {
min_align = 214, base_after_vec = 0, min_after_vec = 0,
max_after_vec = 1, min_after_base = 1, max_after_base = 1,
offset_unsigned = 1, 3, scale = 1}, rt_cselib = 0x1fcd6,
rtbit = 0x1fcd6, rttree = 0x1fcd6, bb = 0x1fcd6}}}
(gdb) p *note
$21 = {code = EXPR_LIST, mode = XCmode, jump = 0, call = 0, unchanging = 0,
volatil = 0, in_struct = 0, used = 0, integrated = 0, frame_related = 0,
fld = {{rtwint = 1122679264, rtint = 1122679264, rtuint = 1122679264,
vrtstr = 0x42eab9e0 "4", rtx = 0x42eab9e0, rtvec = 0x42eab9e0,
rttype = 1122679264, rt_addr_diff_vec_flags = {min_align = 224,
base_after_vec = 1, min_after_vec = 0, max_after_vec = 0,
min_after_base = 1, max_after_base = 1, offset_unsigned = 1, 2,
scale = 234}, rt_cselib = 0x42eab9e0, rtbit = 0x42eab9e0,
rttree = 0x42eab9e0, bb = 0x42eab9e0}}}
(gdb) s
787 if (REG_NOTE_KIND (note) == REG_LABEL
(gdb) n
784 for (note = REG_NOTES (insn); note; note = next)
(gdb) n
Breakpoint 1, init_label_info (f=0x426697c0) at ../../gcc/jump.c:786
786 next = XEXP (note, 1);
(gdb) p *note
$24 = {code = CONST_INT, mode = VOIDmode, jump = 0, call = 0, unchanging = 0,
volatil = 0, in_struct = 0, used = 0, integrated = 0, frame_related = 0,
fld = {{rtwint = 56, rtint = 56, rtuint = 56,
rtstr = 0x38 <Address 0x38 out of bounds>, rtx = 0x38, rtvec = 0x38,
rttype = CCFPmode, rt_addr_diff_vec_flags = {min_align = 56,
base_after_vec = 0, min_after_vec = 0, max_after_vec = 0,
min_after_base = 0, max_after_base = 0, offset_unsigned = 0, 0,
scale = 0}, rt_cselib = 0x38, rtbit = 0x38, rttree = 0x38, bb = 0x38}}}
(gdb) p next
$26 = 0x34
Obviously incorrect. It should be either valid or 0.
(gdb) c
[gcc]
opencoax.cc:229: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
garloff@pckurt:~/Physics/numerix-2.0-gcc3/mpt/open_coax > gcc -v
Reading specs from /raid/gcc300/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../configure
--with-gcc-version-trigger=/raid/egcs/gcc/version.c --host=i686-pc-linux-gnu
--with-system-zlib --with-gnu-ld --with-gnu-as --enable-libstdcxx-v3
--prefix=/raid/gcc300 --enable-haifa : (reconfigured) ../configure
--with-gcc-version-trigger=/raid/egcs/gcc/version.c --host=i686-pc-linux-gnu
--with-system-zlib --with-gnu-ld --with-gnu-as --enable-libstdcxx-v3
--prefix=/raid/gcc300 --enable-haifa : (reconfigured) : (reconfigured) :
(reconfigured) : (reconfigured) ../configure
--with-gcc-version-trigger=/raid/egcs/gcc/version.c --host=i686-pc-linux-gnu
--with-system-zlib --with-gnu-ld --with-gnu-as --enable-libstdcxx-v3
--prefix=/raid/gcc300 --enable-haifa --enable-threads=posix : (reconfigured)
Thread model: posix
gcc version 3.0 20010612 (prerelease)
Regards,
--
Kurt Garloff <kurt@garloff.de> [Eindhoven, NL]
Physics: Plasma simulations <K.Garloff@Phys.TUE.NL> [TU Eindhoven, NL]
Linux: SCSI, Security <garloff@suse.de> [SuSE Nuernberg, FRG]
(See mail header or public key servers for PGP2 and GPG public keys.)
PGP signature