[commit/obvious] hppa-tdep.c: set sizeof(long double) to 16

Michael Elizabeth Chastain mec.gnu@mindspring.com
Thu Dec 18 22:11:00 GMT 2003


This patch makes hppa_gdbarch_init set sizeof(long double) to 128 bits
instead of leaving it with the default value of 64 bits.

It also wrote a comment documenting the type sizes for various compilers
and model options.  sizeof(long double) is 16 bytes on all compilers and
models that I tested, both ILP32 and LP64.

I ran the test suite on native hppa2.0w-hp-hpux11.11 with gcc 3.3.2, an
ILP32 compiler.  Nothing regressed, and these test scripts showed
improved results:

  gdb.base/sizeof.exp
  gdb.base/store.exp
  gdb.base/structs.exp
  gdb.cp/gdb1355.exp
  gdb.defects/bs14602.exp

This fix looks obvious to me and it's limited to hppa, so I'm committing
it now.

Michael C

2003-12-18  Michael Chastain  <mec.gnu@mindspring.com>

	* hppa-tdep.c (hppa_gdbarch_init): Set sizeof(long_double) to 128.
	Document type sizes for hppa*-*-hpux* compilers available to me.

Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 hppa-tdep.c
*** hppa-tdep.c	23 Nov 2003 20:41:16 -0000	1.107
--- hppa-tdep.c	18 Dec 2003 20:39:08 -0000
*************** hppa_fetch_pointer_argument (struct fram
*** 5064,5069 ****
--- 5064,5099 ----
    return addr;
  }
  
+ /* Here is a table of C type sizes on hppa with various compiles
+    and options.  I measured this on PA 9000/800 with HP-UX 11.11
+    and these compilers:
+ 
+      /usr/ccs/bin/cc    HP92453-01 A.11.01.21
+      /opt/ansic/bin/cc  HP92453-01 B.11.11.28706.GP
+      /opt/aCC/bin/aCC   B3910B A.03.45
+      gcc                gcc 3.3.2 native hppa2.0w-hp-hpux11.11
+ 
+      cc            : 1 2 4 4 8 : 4 8 -- : 4 4
+      ansic +DA1.1  : 1 2 4 4 8 : 4 8 16 : 4 4
+      ansic +DA2.0  : 1 2 4 4 8 : 4 8 16 : 4 4
+      ansic +DA2.0W : 1 2 4 8 8 : 4 8 16 : 8 8
+      acc   +DA1.1  : 1 2 4 4 8 : 4 8 16 : 4 4
+      acc   +DA2.0  : 1 2 4 4 8 : 4 8 16 : 4 4
+      acc   +DA2.0W : 1 2 4 8 8 : 4 8 16 : 8 8
+      gcc           : 1 2 4 4 8 : 4 8 16 : 4 4
+ 
+    Each line is:
+ 
+      compiler and options
+      char, short, int, long, long long
+      float, double, long double
+      char *, void (*)()
+ 
+    So all these compilers use either ILP32 or LP64 model.
+    TODO: gcc has more options so it needs more investigation.
+ 
+    -- chastain 2003-12-18  */
+ 
  static struct gdbarch *
  hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
  {
*************** hppa_gdbarch_init (struct gdbarch_info i
*** 5144,5152 ****
    set_gdbarch_deprecated_register_bytes
      (gdbarch, gdbarch_num_regs (gdbarch) * tdep->bytes_per_address);
    set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
-   set_gdbarch_long_long_bit (gdbarch, 64);
    set_gdbarch_ptr_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
  
    /* The following gdbarch vector elements do not depend on the address
       size, or in any other gdbarch element previously set.  */
    set_gdbarch_function_start_offset (gdbarch, 0);
--- 5174,5186 ----
    set_gdbarch_deprecated_register_bytes
      (gdbarch, gdbarch_num_regs (gdbarch) * tdep->bytes_per_address);
    set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
    set_gdbarch_ptr_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
  
+   /* The following gdbarch vector elements are the same in both ILP32
+      and LP64, but might show differences some day.  */
+   set_gdbarch_long_long_bit (gdbarch, 64);
+   set_gdbarch_long_double_bit (gdbarch, 128);
+ 
    /* The following gdbarch vector elements do not depend on the address
       size, or in any other gdbarch element previously set.  */
    set_gdbarch_function_start_offset (gdbarch, 0);



More information about the Gdb-patches mailing list