This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: optimization/4186: core dump in -O2 on ia32 with attached code (regression to 2.95.*)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]