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: gcc-3.0 20010314: Miscompiled C source with -O3 -fomit-frame-pointer


> 
> On 17 Mar 2001, at 9:20, Mike Harrold wrote:
> 
> > The assembly output is fine. 16(%ebp) is the third parameter passed to
> > the function (the string you're trying to pass to strlen). The reason
> > you're getting a SIGSEGV is because that string is NULL.
> > 
> > You can use gdb to verify this.
> > 
> 
> I can agree if I saw something like
> 
>  	pushl	%ebp
> 	mov	%esp, %ebp         This line is not present in assembler output
>  	pushl	%edi
>  	pushl	%esi
>  	pushl	%ebx
> 	
> but as I used -fomit-frame-pointer, %ebp is undefined at entry of procedure and 
> nothing is put into this register after begin of procedure
> before use. I think we should have something like 
> 	movl  something(%esp) , %ech
> when -fomit-frame-pointer is being used

Oops, my bad. Too early in the morning :-)

Regards,

/Mike

> 
> Andris
> 
> > > 
> > > --Message-Boundary-28126
> > > Content-type: text/plain; charset=US-ASCII
> > > Content-transfer-encoding: 7BIT
> > > Content-description: Mail message body
> > > 
> > > I got following C source (see preprocessed source in attachment and
> > > assembler output in attachment) miscompiled with gcc-3.0 20010314 
> > > (targets i586-pc-msdosdjgpp and i686-pc-linux-gnu):
> > > 
> > > Compiler command line:
> > > 	gcc -O3 -fomit-frame-pointer -S text7.i
> > > 
> > > Bad asembler output: 
> > > 	In procedure _outtextxy contents of register %ebp used but is 
> > > 	undefined. As result I'm getting SIGSEGV when running
> > > 	applications that uses this procedure.
> > > 
> > > This output is for target i586-pc-msdosdjgpp but I got practically the 
> > > same problem also for i686-pc-linux-gnu
> > > 
> > > Andris
> > > 
> > > 	.p2align 4
> > > .globl _outtextxy
> > > _outtextxy:
> > > 	pushl	%ebp
> > > 	pushl	%edi
> > > 	pushl	%esi
> > > 	pushl	%ebx
> > > 	subl	$56, %esp
> > > 	movl	16(%ebp), %ecx
> > > 	pushl	%ecx
> > > 	call	_strlen
> > > 	movl	%eax, %edi
> > > 	movl	___gr_vpt, %ebx
> > > 
> 
> 


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