x86 -mno-push-args buglet?

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Sun Apr 23 01:46:00 GMT 2000


> Compiling:
> 
> long
> func(long long a, long long b)
>   {
>   long long c;
> 
>   c = a / b;
> 
>   return c;
>   }
> 
> with -O2 -S -mno-push-args on an x86 results in:
> 
> 	pushl	%ebp
> 	movl	%esp, %ebp
> 	pushl	%ebx
> 	subl	$20, %esp
> 	movl	8(%ebp), %eax
<SNIP>
> 	addl	$16, %esp
> 	movl	-4(%ebp), %ebx
> 	leave
> 	ret
> 
> What's the "addl $16,%esp" doing there?
Isn't that just deallocation of argument block? Currently
combine_stack_adjustments is unable to kill such dead arithmetic, I am going to
send patch for this quite soon. (Basically I think it is sane to have life
info for stack pointer as well (as for every nonconstant pointer)), but
this brings some problems I didn't tracked down yet.  Once flow generates
the flow info it will kill the store as well.

In case you want constant stack pointer (and no such artefacts) use
-maccumulate-outgong-args.  The -mpush-args isn't particulary usefull for
normal use IMO, but is usefull for me to test behaviour fo calls.c with
various settings.

Honza
> 
> -- John
> -------------------------------------------------------------------------
> |   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
> |    John Wehle    |     Fax: 1-215-540-5495  |                         |
> -------------------------------------------------------------------------


More information about the Gcc-bugs mailing list