This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/4186: core dump in -O2 on ia32 with attached code (regression to 2.95.*)
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, thomas dot hiller at compaq dot com, wilhelm dot nuesser at sap dot com
- Subject: Re: optimization/4186: core dump in -O2 on ia32 with attached code (regression to 2.95.*)
- From: wilson at gcc dot gnu dot org
- Date: 24 Sep 2001 19:45:56 -0000
Synopsis: core dump in -O2 on ia32 with attached code (regression to 2.95.*)
State-Changed-From-To: open->analyzed
State-Changed-By: wilson
State-Changed-When: Mon Sep 24 12:45:55 2001
State-Changed-Why:
This is a sibling call optimization bug. This can be
worked around by using -fno-optimize-sibling-calls.
Note the assembly code for function f1:
f1:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
movl $11, 16(%ebp)
movl 12(%ebp), %eax
movl %eax, 8(%ebp)
movl 16(%ebp), %eax
movl %eax, 12(%ebp)
movl %ebp, %esp
popl %ebp
jmp memcpy
When we store the constant 11 on the stack, we accidentally
overwrite the second incoming argument (keys) before we
read it, and thus we pass 11 as the firt and third arguments
to memcpy, which causes memcpy to segfault, since 11 is
not a valid address.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4186&database=gcc