This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)
Mark Kettenis wrote:
> It's got nothing to do with the Linux version, and probably everything
> with the compiler. Could you post the assembler output that your compiler
> generates for the following fragment:
>
> extern int foo (float f, float g);
>
> void
> bar (void)
> {
> foo (3.14, 2.72);
> }
As you'll see below, I get something completely different.
> In my case this yields:
>
> .file "foo.c"
> .version "01.01"
> gcc2_compiled.:
> .section .rodata
> .align 4
> .LC0:
> .long 0x402e147b
> .align 4
> .LC1:
> .long 0x4048f5c3
> .text
> .align 4
> .globl bar
> .type bar,@function
> bar:
> pushl %ebp
> movl %esp,%ebp
> subl $8,%esp
> addl $-8,%esp
> flds .LC0
> subl $4,%esp
> fstps (%esp)
> flds .LC1
> subl $4,%esp
> fstps (%esp)
> call foo
> addl $16,%esp
> .L2:
> movl %ebp,%esp
> popl %ebp
> ret
> .Lfe1:
> .size bar,.Lfe1-bar
> .ident "GCC: (GNU) 2.95.2 19991024 (release)"
>
> The "subl $4,%esp" and "fstps (%esp)" instructions show that the
> arguments passed to foo() are both four bytes in size. So they can't
> be doubles. This is what I'd expect after reading the processor
> specific SystemV ABI, which AFAIK is used on Linux.
Here's what I get:
.file "foo.c"
.version "01.01"
gcc2_compiled.:
.text
.align 4
.globl bar
.type bar,@function
bar:
pushl %ebp
movl %esp,%ebp
pushl $0x402e147b
pushl $0x4048f5c3
call foo
addl $8,%esp
.L1:
leave
ret
.Lfe1:
.size bar,.Lfe1-bar
.ident "GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2
release)"
This is on a Redhat 6.2 distribution with arch == i686.
Michael
- References:
- [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)
- Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)
- Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)
- Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)
- Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)
- Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)