This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


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

Re: [PATCH]: Promote float args on i386 (attn Hurd, Cygwin, DJGPP...)


   Date: Fri, 12 May 2000 15:25:20 -0700
   From: Michael Snyder <msnyder@cygnus.com>

   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);
   > }


   Mark, 

   Change the above code fragment to "extern int foo();"
   and see what you get then.

Yep, they're indeed pushed as doubles then, since default promotion to
double is now in action.  What is more interesting is to compare the
code produced by the following fragments:

float
foo (f, g)
    float f;
    float g;
{
  return f * g;
}

and

float
foo (float f, float g)
{
  return f * g;
}

The differences were causing the problems you were seeing.  Looks like
nobody noticed any problems since the compilers that we were using
produced the correct debugging info and therefore GDB is never forced
to do the default promotion.

Looks like on more reason to get rid of K&R C to me :-).

Mark

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