Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: ARM: Fix parameter handling of FP types in arm_push_arguments()
@ 2002-02-08  7:50 Corinna Vinschen
  2002-02-08  8:06 ` Richard Earnshaw
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2002-02-08  7:50 UTC (permalink / raw)
  To: gdb-patches

Hi,

while running the testsuite on ARM, I found that the handling
of type `float' as argument type in the function arm_push_arguments()
is pretty buggy.

For some reason the size of float arguments was always given as
sizeof(float) even when K&R style functions are called which
expect the float arguments with sizeof(double).
Up to this point one would expect that calling K&R functions with
float arguments is broken.

As a matter of fact, arm_push_arguments() coerced float args
always to double types so that K&R functions were happy while
calling ANSI style functions getting float args were broken.

The below fix is doing two things now.

- It adds the macro COERCE_FLOAT_TO_DOUBLE() to config/arm/tm-arm.h,
  calling standard_coerce_float_to_double().  This results in
  floats being coerced to double already *before* arm_push_arguments()
  is called.

- It eliminates the now useless (and wrong) special float handling
  from arm_push_arguments().

Corinna

2002-02-08  Corinna Vinschen  <vinschen@redhat.com>

	* arm-tdep.c (arm_push_arguments): Eliminate special float
	type handling.
	* config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
	call standard_coerce_float_to_double().

Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.36
diff -u -p -r1.36 arm-tdep.c
--- arm-tdep.c	2002/02/06 15:21:16	1.36
+++ arm-tdep.c	2002/02/08 15:32:18
@@ -1440,12 +1440,7 @@ arm_push_arguments (int nargs, struct va
       arg_type = check_typedef (VALUE_TYPE (args[argnum]));
       len = TYPE_LENGTH (arg_type);
 
-      /* ANSI C code passes float arguments as integers, K&R code
-         passes float arguments as doubles.  Correct for this here.  */
-      if (TYPE_CODE_FLT == TYPE_CODE (arg_type) && REGISTER_SIZE == len)
-	nstack_size += FP_REGISTER_VIRTUAL_SIZE;
-      else
-	nstack_size += len;
+      nstack_size += len;
     }
 
   /* Allocate room on the stack, and initialize our stack frame
@@ -1482,21 +1477,6 @@ arm_push_arguments (int nargs, struct va
       typecode = TYPE_CODE (arg_type);
       val = (char *) VALUE_CONTENTS (args[argnum]);
 
-      /* ANSI C code passes float arguments as integers, K&R code
-         passes float arguments as doubles.  The .stabs record for 
-         for ANSI prototype floating point arguments records the
-         type as FP_INTEGER, while a K&R style (no prototype)
-         .stabs records the type as FP_FLOAT.  In this latter case
-         the compiler converts the float arguments to double before
-         calling the function.  */
-      if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len)
-	{
-	  DOUBLEST dblval;
-	  dblval = extract_floating (val, len);
-	  len = TARGET_DOUBLE_BIT / TARGET_CHAR_BIT;
-	  val = alloca (len);
-	  store_floating (val, len, dblval);
-	}
 #if 1
       /* I don't know why this code was disable. The only logical use
          for a function pointer is to call that function, so setting
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.23
diff -u -p -r1.23 tm-arm.h
--- tm-arm.h	2002/02/06 15:21:17	1.23
+++ tm-arm.h	2002/02/08 15:32:20
@@ -430,4 +430,6 @@ extern int arm_pc_is_thumb (bfd_vma mema
    a Thumb function.  */
 extern int arm_pc_is_thumb_dummy (bfd_vma memaddr);
 
+#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (standard_coerce_float_to_double (formal, actual))
+
 #endif /* TM_ARM_H */


-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: ARM: Fix parameter handling of FP types in  arm_push_arguments()
  2002-02-08  7:50 [RFA]: ARM: Fix parameter handling of FP types in arm_push_arguments() Corinna Vinschen
@ 2002-02-08  8:06 ` Richard Earnshaw
  2002-02-08  8:13   ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Earnshaw @ 2002-02-08  8:06 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard.Earnshaw

> Hi,
> 
> while running the testsuite on ARM, I found that the handling
> of type `float' as argument type in the function arm_push_arguments()
> is pretty buggy.
> 
> For some reason the size of float arguments was always given as
> sizeof(float) even when K&R style functions are called which
> expect the float arguments with sizeof(double).
> Up to this point one would expect that calling K&R functions with
> float arguments is broken.
> 
> As a matter of fact, arm_push_arguments() coerced float args
> always to double types so that K&R functions were happy while
> calling ANSI style functions getting float args were broken.
> 
> The below fix is doing two things now.
> 
> - It adds the macro COERCE_FLOAT_TO_DOUBLE() to config/arm/tm-arm.h,
>   calling standard_coerce_float_to_double().  This results in
>   floats being coerced to double already *before* arm_push_arguments()
>   is called.
> 
> - It eliminates the now useless (and wrong) special float handling
>   from arm_push_arguments().
> 
> Corinna
> 
> 2002-02-08  Corinna Vinschen  <vinschen@redhat.com>
> 
> 	* arm-tdep.c (arm_push_arguments): Eliminate special float
> 	type handling.
> 	* config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
> 	call standard_coerce_float_to_double().

This looks good to me.  Is there a anything in the testsuite that is fixed 
by this?  If not, can you provide one.

R.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: ARM: Fix parameter handling of FP types in arm_push_arguments()
  2002-02-08  8:06 ` Richard Earnshaw
@ 2002-02-08  8:13   ` Corinna Vinschen
  2002-02-10  0:58     ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2002-02-08  8:13 UTC (permalink / raw)
  To: gdb-patches

On Fri, Feb 08, 2002 at 04:05:13PM +0000, Richard Earnshaw wrote:
> > Hi,
> > 
> > while running the testsuite on ARM, I found that the handling
> > of type `float' as argument type in the function arm_push_arguments()
> > is pretty buggy.
> > 
> > For some reason the size of float arguments was always given as
> > sizeof(float) even when K&R style functions are called which
> > expect the float arguments with sizeof(double).
> > Up to this point one would expect that calling K&R functions with
> > float arguments is broken.
> > 
> > As a matter of fact, arm_push_arguments() coerced float args
> > always to double types so that K&R functions were happy while
> > calling ANSI style functions getting float args were broken.
> > 
> > The below fix is doing two things now.
> > 
> > - It adds the macro COERCE_FLOAT_TO_DOUBLE() to config/arm/tm-arm.h,
> >   calling standard_coerce_float_to_double().  This results in
> >   floats being coerced to double already *before* arm_push_arguments()
> >   is called.
> > 
> > - It eliminates the now useless (and wrong) special float handling
> >   from arm_push_arguments().
> > 
> > Corinna
> > 
> > 2002-02-08  Corinna Vinschen  <vinschen@redhat.com>
> > 
> > 	* arm-tdep.c (arm_push_arguments): Eliminate special float
> > 	type handling.
> > 	* config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
> > 	call standard_coerce_float_to_double().
> 
> This looks good to me.  Is there a anything in the testsuite that is fixed 
> by this?  If not, can you provide one.

Together with the "Fix FP handling for non-multiarched targets"
patch from a few minutes ago this fixes at least the FAILs in
callfuncs.exp, display.exp and oct.exp.  I don't have the whole
list handy by now.

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: ARM: Fix parameter handling of FP types in arm_push_arguments()
  2002-02-08  8:13   ` Corinna Vinschen
@ 2002-02-10  0:58     ` Corinna Vinschen
  2002-02-14  7:59       ` Fernando Nasser
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2002-02-10  0:58 UTC (permalink / raw)
  To: gdb-patches

On Fri, Feb 08, 2002 at 05:13:05PM +0100, Corinna Vinschen wrote:
> On Fri, Feb 08, 2002 at 04:05:13PM +0000, Richard Earnshaw wrote:
> > > 2002-02-08  Corinna Vinschen  <vinschen@redhat.com>
> > > 
> > > 	* arm-tdep.c (arm_push_arguments): Eliminate special float
> > > 	type handling.
> > > 	* config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
> > > 	call standard_coerce_float_to_double().
> > 
> > This looks good to me.  Is there a anything in the testsuite that is fixed 
> > by this?  If not, can you provide one.
> 
> Together with the "Fix FP handling for non-multiarched targets"
> patch from a few minutes ago this fixes at least the FAILs in
> callfuncs.exp, display.exp and oct.exp.  I don't have the whole
> list handy by now.
> 
> Corinna

Uhm, is it ok to commit now?

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: ARM: Fix parameter handling of FP types in  arm_push_arguments()
  2002-02-10  0:58     ` Corinna Vinschen
@ 2002-02-14  7:59       ` Fernando Nasser
  2002-02-14 11:01         ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Fernando Nasser @ 2002-02-14  7:59 UTC (permalink / raw)
  To: gdb-patches

Corinna Vinschen wrote:
> 
> On Fri, Feb 08, 2002 at 05:13:05PM +0100, Corinna Vinschen wrote:
> > On Fri, Feb 08, 2002 at 04:05:13PM +0000, Richard Earnshaw wrote:
> > > > 2002-02-08  Corinna Vinschen  <vinschen@redhat.com>
> > > >
> > > >   * arm-tdep.c (arm_push_arguments): Eliminate special float
> > > >   type handling.
> > > >   * config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
> > > >   call standard_coerce_float_to_double().
> > >
> > > This looks good to me.  Is there a anything in the testsuite that is fixed
> > > by this?  If not, can you provide one.
> >
> > Together with the "Fix FP handling for non-multiarched targets"
> > patch from a few minutes ago this fixes at least the FAILs in
> > callfuncs.exp, display.exp and oct.exp.  I don't have the whole
> > list handy by now.
> >
> > Corinna
> 
> Uhm, is it ok to commit now?
> 

I don't have any objection either so please check it in.

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: ARM: Fix parameter handling of FP types in arm_push_arguments()
  2002-02-14  7:59       ` Fernando Nasser
@ 2002-02-14 11:01         ` Corinna Vinschen
  2002-02-14 11:07           ` Richard Earnshaw
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2002-02-14 11:01 UTC (permalink / raw)
  To: gdb-patches

On Thu, Feb 14, 2002 at 10:58:53AM -0500, Fernando Nasser wrote:
> Corinna Vinschen wrote:
> > 
> > On Fri, Feb 08, 2002 at 05:13:05PM +0100, Corinna Vinschen wrote:
> > > On Fri, Feb 08, 2002 at 04:05:13PM +0000, Richard Earnshaw wrote:
> > > > > 2002-02-08  Corinna Vinschen  <vinschen@redhat.com>
> > > > >
> > > > >   * arm-tdep.c (arm_push_arguments): Eliminate special float
> > > > >   type handling.
> > > > >   * config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
> > > > >   call standard_coerce_float_to_double().
> > > >
> > > > This looks good to me.  Is there a anything in the testsuite that is fixed
> > > > by this?  If not, can you provide one.
> > >
> > > Together with the "Fix FP handling for non-multiarched targets"
> > > patch from a few minutes ago this fixes at least the FAILs in
> > > callfuncs.exp, display.exp and oct.exp.  I don't have the whole
> > > list handy by now.
> > >
> > > Corinna
> > 
> > Uhm, is it ok to commit now?
> > 
> 
> I don't have any objection either so please check it in.

Commited.

Thanks,
Corinna


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: ARM: Fix parameter handling of FP types in  arm_push_arguments()
  2002-02-14 11:01         ` Corinna Vinschen
@ 2002-02-14 11:07           ` Richard Earnshaw
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Earnshaw @ 2002-02-14 11:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard.Earnshaw

> On Thu, Feb 14, 2002 at 10:58:53AM -0500, Fernando Nasser wrote:
> > Corinna Vinschen wrote:
> > > 
> > > On Fri, Feb 08, 2002 at 05:13:05PM +0100, Corinna Vinschen wrote:
> > > > On Fri, Feb 08, 2002 at 04:05:13PM +0000, Richard Earnshaw wrote:
> > > > > > 2002-02-08  Corinna Vinschen  <vinschen@redhat.com>
> > > > > >
> > > > > >   * arm-tdep.c (arm_push_arguments): Eliminate special float
> > > > > >   type handling.
> > > > > >   * config/arm/tm-arm.h (COERCE_FLOAT_TO_DOUBLE): Define to
> > > > > >   call standard_coerce_float_to_double().
> > > > >
> > > > > This looks good to me.  Is there a anything in the testsuite that is fixed
> > > > > by this?  If not, can you provide one.
> > > >
> > > > Together with the "Fix FP handling for non-multiarched targets"
> > > > patch from a few minutes ago this fixes at least the FAILs in
> > > > callfuncs.exp, display.exp and oct.exp.  I don't have the whole
> > > > list handy by now.
> > > >
> > > > Corinna
> > > 
> > > Uhm, is it ok to commit now?
> > > 
> > 
> > I don't have any objection either so please check it in.
> 
> Commited.
> 
> Thanks,
> Corinna

Ah!  Of course this should be done the multi-arch way now...

R.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-02-14 19:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-08  7:50 [RFA]: ARM: Fix parameter handling of FP types in arm_push_arguments() Corinna Vinschen
2002-02-08  8:06 ` Richard Earnshaw
2002-02-08  8:13   ` Corinna Vinschen
2002-02-10  0:58     ` Corinna Vinschen
2002-02-14  7:59       ` Fernando Nasser
2002-02-14 11:01         ` Corinna Vinschen
2002-02-14 11:07           ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox