Blame SOURCES/gdb-rhbz795424-bitpos-23of25.patch

7bc85d
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
7bc85d
From: Fedora GDB patches <invalid@email.com>
7bc85d
Date: Fri, 27 Oct 2017 21:07:50 +0200
7bc85d
Subject: gdb-rhbz795424-bitpos-23of25.patch
7bc85d
7bc85d
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
7bc85d
;; (RH BZ 795424).
7bc85d
;;=push
7bc85d
7bc85d
http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html
7bc85d
7bc85d
--MP_/X_WjDOvz/B_fvlsrmCwRdxe
7bc85d
Content-Type: text/plain; charset=US-ASCII
7bc85d
Content-Transfer-Encoding: 7bit
7bc85d
Content-Disposition: inline
7bc85d
7bc85d
Hi,
7bc85d
7bc85d
This is the last part of the bitpos change.  This patch does the same
7bc85d
thing that patch 1/4 does, except that it does so in the *-tdep files
7bc85d
wherever necessary.  I separated these changes mainly because they are
7bc85d
related and can be reviewed independently.  Tested on Fedora 16 x86_64.
7bc85d
7bc85d
Regards,
7bc85d
Siddhesh
7bc85d
7bc85d
--MP_/X_WjDOvz/B_fvlsrmCwRdxe
7bc85d
Content-Type: text/plain
7bc85d
Content-Transfer-Encoding: quoted-printable
7bc85d
Content-Disposition: attachment; filename=ChangeLog-tdep
7bc85d
7bc85d
gdb/ChangeLog
7bc85d
7bc85d
	* alpha-tdep.c (alpha_push_dummy_call): Expand ACCUMULATE_SIZE,
7bc85d
	REQUIRED_ARG_REGS, OFFSET, LEN, TLEN to ssize_t.
7bc85d
	(struct alpha_arg): Expand members LEN, OFFSET to ssize_t.
7bc85d
	* amd64-tdep.c (amd64_push_arguments): Expand NUM_ELEMENTS,
7bc85d
	ELEMENT and LEN to LONGEST.
7bc85d
	(amd64_return_value): Expand LEN to LONGEST.
7bc85d
	* amd64-windows-tdep.c (amd64_windows_return_value): Expand LEN
7bc85d
	to LONGEST.
7bc85d
	* arm-tdep.c (arm_vfp_cprc_sub_candidate): Return LONGEST.
7bc85d
	Expand COUNT, SUB_COUNT to LONGEST.
7bc85d
	(arm_vfp_call_candidate): Expand C to LONGEST.
7bc85d
	(arm_push_dummy_call): Expand LEN to LONGEST.
7bc85d
	* avr-tdep.c (struct stack_item): Expand member LEN to ssize_t.
7bc85d
	(push_stack_item): Expand parameter LEN to ssize_t.
7bc85d
	(avr_push_dummy_call): Expand LAST_REGNUM, J, LEN to ssize_t.
7bc85d
	* bfin-tdep.c (bfin_push_dummy_call): Expand TOTAL_LEN,
7bc85d
	CONTAINER_LEN to ssize_t.
7bc85d
	* cris-tdep.c (struct stack_item): Expand member LEN to ssize_t.
7bc85d
	(push_stack_item): Expand parameter LEN to ssize_t.
7bc85d
	(cris_push_dummy_call): Expand LEN, REG_DEMAND, I to ssize_t.
7bc85d
	* h8300-tdep.c (h8300_push_dummy_call): Expand STACK_ALLOC,
7bc85d
	STACK_OFFSET to LONGEST.  Expand LEN, PADDED_LEN, OFFSET to
7bc85d
	ssize_t.
7bc85d
	* hppa-tdep.c (hppa64_push_dummy_call): Expand LEN to LONGEST.
7bc85d
	(hppa64_return_value): Likewise.
7bc85d
	* i386-darwin-tdep.c (i386_darwin_push_dummy_call): Expand
7bc85d
	ARGS_SPACE to LONGEST.
7bc85d
	* i386-tdep.c (i386_push_dummy_call): Expand ARG_SPACE,
7bc85d
	ARG_SPACE_USED, LEN to LONGEST.
7bc85d
	(i386_reg_struct_return_p): Expand LEN to LONGEST.
7bc85d
	(i386_convert_register_p): Likewise.
7bc85d
	(i386_register_to_value): Likewise.
7bc85d
	(i386_value_to_register): Likewise.
7bc85d
	* ia64-tdep.c (ia64_push_dummy_call): Expand ARGOFFSET, LEN,
7bc85d
	NSLOTS, MEMSLOTS to LONGEST.
7bc85d
	* iq2000-tdep.c (iq2000_push_dummy_call): Expand TYPELEN,
7bc85d
	STACKSPACE to LONGEST.
7bc85d
	* m32r-tdep.c (m32r_push_dummy_call): Expand LEN to LONGEST.
7bc85d
	* m68k-tdep.c (m68k_reg_struct_return_p): Expand LEN to LONGEST.
7bc85d
	(m68k_push_dummy_call): Expand LEN, CONTAINER_LEN, OFFSET to
7bc85d
	LONGEST.
7bc85d
	* m88k-tdep.c (m88k_store_arguments): Expand NUM_STACK_WORDS,
7bc85d
	LEN, STACK_WORD to LONGEST.
7bc85d
	* mep-tdep.c (push_large_arguments): Expand ARG_LEN to ULONGEST.
7bc85d
	* microblaze-tdep.c (microblaze_store_return_value): Expand LEN to
7bc85d
	LONGEST.
7bc85d
	* mips-tdep.c (mips_xfer_register): Expand parameter BUF_OFFSET to
7bc85d
	LONGEST.  Use plongest to format print BUF_OFFSET.
7bc85d
	(mips_eabi_push_dummy_call): Expand LEN to LONGEST.  Use plongest
7bc85d
	to format print LEN.
7bc85d
	(mips_n32n64_fp_arg_chunk_p): Expand parameter OFFSET to LONGEST.
7bc85d
	Expand POS to LONGEST.
7bc85d
	(mips_n32n64_push_dummy_call): Expand LEN to LONGEST.
7bc85d
	(mips_n32n64_return_value): Expand OFFSET to LONGEST.  Use
7bc85d
	plongest to format print OFFSET.
7bc85d
	(mips_o32_push_dummy_call): Expand LEN to LONGEST.  Use plongest
7bc85d
	to format print LEN.
7bc85d
	(mips_o64_push_dummy_call): Expand LEN, STACK_OFFSET to LONGEST.
7bc85d
	Use plongest to format print LEN.
7bc85d
	* mn10300-tdep.c (mn10300_push_dummy_call): Expand LEN to
7bc85d
	LONGEST.
7bc85d
	* mt-tdep.c (mt_push_dummy_call): Expand STACK_DEST, TYPELEN to
7bc85d
	LONGEST.
7bc85d
	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Expand
7bc85d
	ARGSPACE, ARGOFFSET, STRUCTOFFSET, LEN, to LONGEST.
7bc85d
	(ppc64_sysv_abi_push_dummy_call): Expand BYTE, LEN to ssize_t.
7bc85d
	* rl78-tdep.c (rl78_push_dummy_call): Expand LEN, CONTAINER_LEN
7bc85d
	to LONGEST.
7bc85d
	* rs6000-aix-tdep.c (rs6000_push_dummy_call): Expand ARGBYTES,
7bc85d
	LEN to LONGEST.
7bc85d
	(ran_out_of_registers_for_arguments): Expand SPACE, JJ to
7bc85d
	LONGEST.
7bc85d
	* s390-linux-tdep.c (s390_value_from_register): Expand LEN to LONGEST.
7bc85d
	(is_power_of_two): Expand parameter N to ULONGEST.
7bc85d
	(s390_push_dummy_call): Expand LENGTH to ULONGEST.
7bc85d
	* score-tdep.c (score_push_dummy_call): Expand ARGLEN to
7bc85d
	LONGEST.
7bc85d
	* sh-tdep.c (sh_use_struct_convention) Expand len to LONGEST.
7bc85d
	(sh_justify_value_in_reg): Expand parameter LEN to LONGEST.
7bc85d
	(sh_push_dummy_call_fpu): Expand LEN to LONGEST.  Expand REG_SIZE
7bc85d
	to ssize_t.
7bc85d
	(sh_push_dummy_call_nofpu): Likewise.
7bc85d
	* sh64-tdep.c (sh64_push_dummy_call): Expand STACK_OFFSET,
7bc85d
	STACK_ALLOC, LEN to LONGEST.
7bc85d
	* sparc-tdep.c (sparc32_store_arguments): Expand LEN to LONGEST.
7bc85d
	* sparc64-tdep.c (sparc64_store_floating_fields): Expand
7bc85d
	parameter BITPOS to LONGEST.  Expand SUBPOS to LONGEST.
7bc85d
	(sparc64_extract_floating_fields): Likewise.
7bc85d
	(sparc64_store_arguments): Expand LEN to LONGEST.
7bc85d
	* spu-tdep.c (spu_push_dummy_call): Expand N_REGS, LEN to LONGEST.
7bc85d
	(spu_value_from_register): Expand LEN to LONGEST.
7bc85d
	* tic6x-tdep.c (tic6x_push_dummy_call): Expand REFERENCES_OFFST,
7bc85d
	LEN to LONGEST.  Expand LEN to ssize_t.  Use plongest to format
7bc85d
	print LEN.
7bc85d
	* tilegx-tdep.c (tilegx_push_dummy_call): Expand TYPELEN,
7bc85d
	SLACKLEN, ALIGNLEN to LONGEST.
7bc85d
	* v850-tdep.c (v850_push_dummy_call): Expand LEN to LONGEST.
7bc85d
	* vax-tdep.c (vax_store_arguments): Expand COUNT, LEN to LONGEST.
7bc85d
	(vax_return_value): Expand LEN to LONGEST.
7bc85d
	* xstormy16-tdep.c (xstormy16_push_dummy_call): Expand J, TYPELEN
7bc85d
	to LONGEST.
7bc85d
	* xtensa-tdep.c (xtensa_store_return_value): Print LEN instead of
7bc85d
	TYPE_LENGTH..
7bc85d
	(struct argument_info): Expoand member LENGTH to ssize_t.
7bc85d
	(struct argument_info.u): Expand member OFFSET to ssize_t.
7bc85d
	(xtensa_push_dummy_call): Expand SIZE, ONSTACK_SIZE to LONGEST.
7bc85d
	Expand N to ssize_t.  Use pulongest to format print TYPE_LENGTH.
7bc85d
7bc85d
--MP_/X_WjDOvz/B_fvlsrmCwRdxe
7bc85d
Content-Type: text/x-patch
7bc85d
Content-Transfer-Encoding: 7bit
7bc85d
Content-Disposition: attachment; filename=bitpos-tdep.patch
7bc85d
7bc85d
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
7bc85d
--- a/gdb/alpha-tdep.c
7bc85d
+++ b/gdb/alpha-tdep.c
7bc85d
@@ -299,17 +299,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 {
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int i;
7bc85d
-  int accumulate_size = struct_return ? 8 : 0;
7bc85d
+  ssize_t accumulate_size = struct_return ? 8 : 0;
7bc85d
   struct alpha_arg
7bc85d
     {
7bc85d
       const gdb_byte *contents;
7bc85d
-      int len;
7bc85d
-      int offset;
7bc85d
+      ssize_t len;
7bc85d
+      ssize_t offset;
7bc85d
     };
7bc85d
   struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs);
7bc85d
   struct alpha_arg *m_arg;
7bc85d
   gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS];
7bc85d
-  int required_arg_regs;
7bc85d
+  ssize_t required_arg_regs;
7bc85d
   CORE_ADDR func_addr = find_function_addr (function, NULL);
7bc85d
 
7bc85d
   /* The ABI places the address of the called function in T12.  */
7bc85d
@@ -429,8 +429,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   for (i = nargs; m_arg--, --i >= 0;)
7bc85d
     {
7bc85d
       const gdb_byte *contents = m_arg->contents;
7bc85d
-      int offset = m_arg->offset;
7bc85d
-      int len = m_arg->len;
7bc85d
+      ssize_t offset = m_arg->offset;
7bc85d
+      ssize_t len = m_arg->len;
7bc85d
 
7bc85d
       /* Copy the bytes destined for registers into arg_reg_buffer.  */
7bc85d
       if (offset < sizeof(arg_reg_buffer))
7bc85d
@@ -442,7 +442,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 	    }
7bc85d
 	  else
7bc85d
 	    {
7bc85d
-	      int tlen = sizeof(arg_reg_buffer) - offset;
7bc85d
+	      ssize_t tlen = sizeof(arg_reg_buffer) - offset;
7bc85d
 	      memcpy (arg_reg_buffer + offset, contents, tlen);
7bc85d
 	      offset += tlen;
7bc85d
 	      contents += tlen;
7bc85d
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
7bc85d
--- a/gdb/amd64-tdep.c
7bc85d
+++ b/gdb/amd64-tdep.c
7bc85d
@@ -878,8 +878,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
7bc85d
   };
7bc85d
   struct value **stack_args = XALLOCAVEC (struct value *, nargs);
7bc85d
   int num_stack_args = 0;
7bc85d
-  int num_elements = 0;
7bc85d
-  int element = 0;
7bc85d
+  LONGEST num_elements = 0;
7bc85d
+  LONGEST element = 0;
7bc85d
   int integer_reg = 0;
7bc85d
   int sse_reg = 0;
7bc85d
   int i;
7bc85d
@@ -891,7 +891,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
7bc85d
   for (i = 0; i < nargs; i++)
7bc85d
     {
7bc85d
       struct type *type = value_type (args[i]);
7bc85d
-      int len = TYPE_LENGTH (type);
7bc85d
+      LONGEST len = TYPE_LENGTH (type);
7bc85d
       enum amd64_reg_class theclass[2];
7bc85d
       int needed_integer_regs = 0;
7bc85d
       int needed_sse_regs = 0;
7bc85d
@@ -955,7 +955,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
7bc85d
 
7bc85d
 	      gdb_assert (regnum != -1);
7bc85d
 	      memset (buf, 0, sizeof buf);
7bc85d
-	      memcpy (buf, valbuf + j * 8, std::min (len, 8));
7bc85d
+	      memcpy (buf, valbuf + j * 8, std::min (len, (LONGEST) 8));
7bc85d
 	      regcache->raw_write_part (regnum, offset, 8, buf);
7bc85d
 	    }
7bc85d
 	}
7bc85d
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
7bc85d
--- a/gdb/amd64-windows-tdep.c
7bc85d
+++ b/gdb/amd64-windows-tdep.c
7bc85d
@@ -291,7 +291,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
7bc85d
 			    struct type *type, struct regcache *regcache,
7bc85d
 			    gdb_byte *readbuf, const gdb_byte *writebuf)
7bc85d
 {
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
   int regnum = -1;
7bc85d
 
7bc85d
   /* See if our value is returned through a register.  If it is, then
7bc85d
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
7bc85d
--- a/gdb/arm-tdep.c
7bc85d
+++ b/gdb/arm-tdep.c
7bc85d
@@ -3468,7 +3468,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
7bc85d
    array).  Vector types are not currently supported, matching the
7bc85d
    generic AAPCS support.  */
7bc85d
 
7bc85d
-static int
7bc85d
+static LONGEST
7bc85d
 arm_vfp_cprc_sub_candidate (struct type *t,
7bc85d
 			    enum arm_vfp_cprc_base_type *base_type)
7bc85d
 {
7bc85d
@@ -3551,7 +3551,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
7bc85d
 	  }
7bc85d
 	else
7bc85d
 	  {
7bc85d
-	    int count;
7bc85d
+	    LONGEST count;
7bc85d
 	    unsigned unitlen;
7bc85d
 
7bc85d
 	    count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
7bc85d
@@ -3574,12 +3574,12 @@ arm_vfp_cprc_sub_candidate (struct type *t,
7bc85d
 
7bc85d
     case TYPE_CODE_STRUCT:
7bc85d
       {
7bc85d
-	int count = 0;
7bc85d
+	LONGEST count = 0;
7bc85d
 	unsigned unitlen;
7bc85d
 	int i;
7bc85d
 	for (i = 0; i < TYPE_NFIELDS (t); i++)
7bc85d
 	  {
7bc85d
-	    int sub_count = 0;
7bc85d
+	    LONGEST sub_count = 0;
7bc85d
 
7bc85d
 	    if (!field_is_static (&TYPE_FIELD (t, i)))
7bc85d
 	      sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
7bc85d
@@ -3603,13 +3603,15 @@ arm_vfp_cprc_sub_candidate (struct type *t,
7bc85d
 
7bc85d
     case TYPE_CODE_UNION:
7bc85d
       {
7bc85d
-	int count = 0;
7bc85d
+	LONGEST count = 0;
7bc85d
 	unsigned unitlen;
7bc85d
 	int i;
7bc85d
 	for (i = 0; i < TYPE_NFIELDS (t); i++)
7bc85d
 	  {
7bc85d
-	    int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
7bc85d
-							base_type);
7bc85d
+	    LONGEST sub_count;
7bc85d
+
7bc85d
+	    sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
7bc85d
+						    base_type);
7bc85d
 	    if (sub_count == -1)
7bc85d
 	      return -1;
7bc85d
 	    count = (count > sub_count ? count : sub_count);
7bc85d
@@ -3645,7 +3647,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type,
7bc85d
 			int *count)
7bc85d
 {
7bc85d
   enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN;
7bc85d
-  int c = arm_vfp_cprc_sub_candidate (t, &b);
7bc85d
+  LONGEST c = arm_vfp_cprc_sub_candidate (t, &b);
7bc85d
   if (c <= 0 || c > 4)
7bc85d
     return 0;
7bc85d
   *base_type = b;
7bc85d
@@ -3726,7 +3728,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
   for (argnum = 0; argnum < nargs; argnum++)
7bc85d
     {
7bc85d
-      int len;
7bc85d
+      LONGEST len;
7bc85d
       struct type *arg_type;
7bc85d
       struct type *target_type;
7bc85d
       enum type_code typecode;
7bc85d
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
7bc85d
--- a/gdb/avr-tdep.c
7bc85d
+++ b/gdb/avr-tdep.c
7bc85d
@@ -1192,13 +1192,13 @@ avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
7bc85d
 
7bc85d
 struct stack_item
7bc85d
 {
7bc85d
-  int len;
7bc85d
+  ssize_t len;
7bc85d
   struct stack_item *prev;
7bc85d
   gdb_byte *data;
7bc85d
 };
7bc85d
 
7bc85d
 static struct stack_item *
7bc85d
-push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
7bc85d
+push_stack_item (struct stack_item *prev, const bfd_byte *contents, ssize_t len)
7bc85d
 {
7bc85d
   struct stack_item *si;
7bc85d
   si = XNEW (struct stack_item);
7bc85d
@@ -1286,12 +1286,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
   for (i = 0; i < nargs; i++)
7bc85d
     {
7bc85d
-      int last_regnum;
7bc85d
-      int j;
7bc85d
+      ssize_t last_regnum;
7bc85d
+      ssize_t j;
7bc85d
       struct value *arg = args[i];
7bc85d
       struct type *type = check_typedef (value_type (arg));
7bc85d
       const bfd_byte *contents = value_contents (arg);
7bc85d
-      int len = TYPE_LENGTH (type);
7bc85d
+      ssize_t len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
       /* Calculate the potential last register needed.
7bc85d
          E.g. For length 2, registers regnum and regnum-1 (say 25 and 24)
7bc85d
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
7bc85d
--- a/gdb/bfin-tdep.c
7bc85d
+++ b/gdb/bfin-tdep.c
7bc85d
@@ -504,7 +504,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int i;
7bc85d
   long reg_r0, reg_r1, reg_r2;
7bc85d
-  int total_len = 0;
7bc85d
+  ssize_t total_len = 0;
7bc85d
 
7bc85d
   for (i = nargs - 1; i >= 0; i--)
7bc85d
     {
7bc85d
@@ -526,7 +526,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
     {
7bc85d
       struct type *value_type = value_enclosing_type (args[i]);
7bc85d
       struct type *arg_type = check_typedef (value_type);
7bc85d
-      int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
7bc85d
+      ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
7bc85d
 
7bc85d
       sp -= container_len;
7bc85d
       write_memory (sp, value_contents (args[i]), container_len);
7bc85d
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
7bc85d
--- a/gdb/cris-tdep.c
7bc85d
+++ b/gdb/cris-tdep.c
7bc85d
@@ -663,13 +663,13 @@ static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch,
7bc85d
 
7bc85d
 struct stack_item
7bc85d
 {
7bc85d
-  int len;
7bc85d
+  ssize_t len;
7bc85d
   struct stack_item *prev;
7bc85d
   gdb_byte *data;
7bc85d
 };
7bc85d
 
7bc85d
 static struct stack_item *
7bc85d
-push_stack_item (struct stack_item *prev, const gdb_byte *contents, int len)
7bc85d
+push_stack_item (struct stack_item *prev, const gdb_byte *contents, ssize_t len)
7bc85d
 {
7bc85d
   struct stack_item *si = XNEW (struct stack_item);
7bc85d
   si->data = (gdb_byte *) xmalloc (len);
7bc85d
@@ -833,13 +833,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
   for (argnum = 0; argnum < nargs; argnum++)
7bc85d
     {
7bc85d
-      int len;
7bc85d
+      ssize_t len;
7bc85d
       const gdb_byte *val;
7bc85d
-      int reg_demand;
7bc85d
-      int i;
7bc85d
+      ssize_t reg_demand;
7bc85d
+      ssize_t i;
7bc85d
       
7bc85d
-      len = TYPE_LENGTH (value_type (args[argnum]));
7bc85d
       val = value_contents (args[argnum]);
7bc85d
+      len = TYPE_LENGTH (value_type (args[argnum]));
7bc85d
       
7bc85d
       /* How may registers worth of storage do we need for this argument?  */
7bc85d
       reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
7bc85d
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
7bc85d
--- a/gdb/h8300-tdep.c
7bc85d
+++ b/gdb/h8300-tdep.c
7bc85d
@@ -637,7 +637,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 		       int struct_return, CORE_ADDR struct_addr)
7bc85d
 {
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
-  int stack_alloc = 0, stack_offset = 0;
7bc85d
+  LONGEST stack_alloc = 0, stack_offset = 0;
7bc85d
   int wordsize = BINWORD (gdbarch);
7bc85d
   int reg = E_ARG0_REGNUM;
7bc85d
   int argument;
7bc85d
@@ -663,11 +663,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   for (argument = 0; argument < nargs; argument++)
7bc85d
     {
7bc85d
       struct type *type = value_type (args[argument]);
7bc85d
-      int len = TYPE_LENGTH (type);
7bc85d
+      ssize_t len = TYPE_LENGTH (type);
7bc85d
       char *contents = (char *) value_contents (args[argument]);
7bc85d
 
7bc85d
       /* Pad the argument appropriately.  */
7bc85d
-      int padded_len = align_up (len, wordsize);
7bc85d
+      ssize_t padded_len = align_up (len, wordsize);
7bc85d
       /* Use std::vector here to get zero initialization.  */
7bc85d
       std::vector<gdb_byte> padded (padded_len);
7bc85d
 
7bc85d
@@ -696,7 +696,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 	      /* Heavens to Betsy --- it's really going in registers!
7bc85d
 	         Note that on the h8/300s, there are gaps between the
7bc85d
 	         registers in the register file.  */
7bc85d
-	      int offset;
7bc85d
+	      ssize_t offset;
7bc85d
 
7bc85d
 	      for (offset = 0; offset < padded_len; offset += wordsize)
7bc85d
 		{
7bc85d
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
7bc85d
--- a/gdb/hppa-tdep.c
7bc85d
+++ b/gdb/hppa-tdep.c
7bc85d
@@ -984,7 +984,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
     {
7bc85d
       struct value *arg = args[i];
7bc85d
       struct type *type = value_type (arg);
7bc85d
-      int len = TYPE_LENGTH (type);
7bc85d
+      LONGEST len = TYPE_LENGTH (type);
7bc85d
       const bfd_byte *valbuf;
7bc85d
       bfd_byte fptrbuf[8];
7bc85d
       int regnum;
7bc85d
@@ -1177,7 +1177,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
7bc85d
 		     struct type *type, struct regcache *regcache,
7bc85d
 		     gdb_byte *readbuf, const gdb_byte *writebuf)
7bc85d
 {
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
   int regnum, offset;
7bc85d
 
7bc85d
   if (len > 16)
7bc85d
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
7bc85d
--- a/gdb/i386-darwin-tdep.c
7bc85d
+++ b/gdb/i386-darwin-tdep.c
7bc85d
@@ -166,7 +166,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
   for (write_pass = 0; write_pass < 2; write_pass++)
7bc85d
     {
7bc85d
-      int args_space = 0;
7bc85d
+      LONGEST args_space = 0;
7bc85d
       int num_m128 = 0;
7bc85d
 
7bc85d
       if (struct_return)
7bc85d
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
7bc85d
--- a/gdb/i386-tdep.c
7bc85d
+++ b/gdb/i386-tdep.c
7bc85d
@@ -2678,7 +2678,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   gdb_byte buf[4];
7bc85d
   int i;
7bc85d
   int write_pass;
7bc85d
-  int args_space = 0;
7bc85d
+  LONGEST args_space = 0;
7bc85d
 
7bc85d
   /* BND registers can be in arbitrary values at the moment of the
7bc85d
      inferior call.  This can cause boundary violations that are not
7bc85d
@@ -2693,7 +2693,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
   for (write_pass = 0; write_pass < 2; write_pass++)
7bc85d
     {
7bc85d
-      int args_space_used = 0;
7bc85d
+      LONGEST args_space_used = 0;
7bc85d
 
7bc85d
       if (struct_return)
7bc85d
 	{
7bc85d
@@ -2710,7 +2710,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
       for (i = 0; i < nargs; i++)
7bc85d
 	{
7bc85d
-	  int len = TYPE_LENGTH (value_enclosing_type (args[i]));
7bc85d
+	  LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i]));
7bc85d
 
7bc85d
 	  if (write_pass)
7bc85d
 	    {
7bc85d
@@ -2917,7 +2917,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
7bc85d
 {
7bc85d
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7bc85d
   enum type_code code = TYPE_CODE (type);
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
   gdb_assert (code == TYPE_CODE_STRUCT
7bc85d
               || code == TYPE_CODE_UNION
7bc85d
@@ -3703,7 +3703,7 @@ static int
7bc85d
 i386_convert_register_p (struct gdbarch *gdbarch,
7bc85d
 			 int regnum, struct type *type)
7bc85d
 {
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
   /* Values may be spread across multiple registers.  Most debugging
7bc85d
      formats aren't expressive enough to specify the locations, so
7bc85d
@@ -3736,7 +3736,7 @@ i386_register_to_value (struct frame_info *frame, int regnum,
7bc85d
 			int *optimizedp, int *unavailablep)
7bc85d
 {
7bc85d
   struct gdbarch *gdbarch = get_frame_arch (frame);
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
   if (i386_fp_regnum_p (gdbarch, regnum))
7bc85d
     return i387_register_to_value (frame, regnum, type, to,
7bc85d
@@ -3772,7 +3772,7 @@ static void
7bc85d
 i386_value_to_register (struct frame_info *frame, int regnum,
7bc85d
 			struct type *type, const gdb_byte *from)
7bc85d
 {
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
   if (i386_fp_regnum_p (get_frame_arch (frame), regnum))
7bc85d
     {
7bc85d
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
7bc85d
--- a/gdb/iq2000-tdep.c
7bc85d
+++ b/gdb/iq2000-tdep.c
7bc85d
@@ -651,8 +651,9 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   const bfd_byte *val;
7bc85d
   bfd_byte buf[4];
7bc85d
   struct type *type;
7bc85d
-  int i, argreg, typelen, slacklen;
7bc85d
-  int stackspace = 0;
7bc85d
+  int i, argreg, slacklen;
7bc85d
+  LONGEST typelen;
7bc85d
+  LONGEST stackspace = 0;
7bc85d
   /* Used to copy struct arguments into the stack.  */
7bc85d
   CORE_ADDR struct_ptr;
7bc85d
 
7bc85d
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
7bc85d
--- a/gdb/m32r-tdep.c
7bc85d
+++ b/gdb/m32r-tdep.c
7bc85d
@@ -671,7 +671,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   CORE_ADDR regval;
7bc85d
   gdb_byte *val;
7bc85d
   gdb_byte valbuf[M32R_ARG_REGISTER_SIZE];
7bc85d
-  int len;
7bc85d
+  LONGEST len;
7bc85d
 
7bc85d
   /* First force sp to a 4-byte alignment.  */
7bc85d
   sp = sp & ~3;
7bc85d
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
7bc85d
--- a/gdb/m68k-tdep.c
7bc85d
+++ b/gdb/m68k-tdep.c
7bc85d
@@ -372,7 +372,7 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
7bc85d
 {
7bc85d
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7bc85d
   enum type_code code = TYPE_CODE (type);
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
   gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
7bc85d
 	      || code == TYPE_CODE_COMPLEX);
7bc85d
@@ -504,9 +504,9 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   for (i = nargs - 1; i >= 0; i--)
7bc85d
     {
7bc85d
       struct type *value_type = value_enclosing_type (args[i]);
7bc85d
-      int len = TYPE_LENGTH (value_type);
7bc85d
-      int container_len = (len + 3) & ~3;
7bc85d
-      int offset;
7bc85d
+      LONGEST len = TYPE_LENGTH (value_type);
7bc85d
+      LONGEST container_len = (len + 3) & ~3;
7bc85d
+      LONGEST offset;
7bc85d
 
7bc85d
       /* Non-scalars bigger than 4 bytes are left aligned, others are
7bc85d
 	 right aligned.  */
7bc85d
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
7bc85d
--- a/gdb/mep-tdep.c
7bc85d
+++ b/gdb/mep-tdep.c
7bc85d
@@ -2239,7 +2239,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
7bc85d
 
7bc85d
   for (i = 0; i < argc; i++)
7bc85d
     {
7bc85d
-      unsigned arg_len = TYPE_LENGTH (value_type (argv[i]));
7bc85d
+      ULONGEST arg_len = TYPE_LENGTH (value_type (argv[i]));
7bc85d
 
7bc85d
       if (arg_len > MEP_GPR_SIZE)
7bc85d
         {
7bc85d
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
7bc85d
--- a/gdb/mips-tdep.c
7bc85d
+++ b/gdb/mips-tdep.c
7bc85d
@@ -489,7 +489,7 @@ static void
7bc85d
 mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
7bc85d
 		    int reg_num, int length,
7bc85d
 		    enum bfd_endian endian, gdb_byte *in,
7bc85d
-		    const gdb_byte *out, int buf_offset)
7bc85d
+		    const gdb_byte *out, LONGEST buf_offset)
7bc85d
 {
7bc85d
   int reg_offset = 0;
7bc85d
 
7bc85d
@@ -512,8 +512,8 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
7bc85d
     }
7bc85d
   if (mips_debug)
7bc85d
     fprintf_unfiltered (gdb_stderr,
7bc85d
-			"xfer $%d, reg offset %d, buf offset %d, length %d, ",
7bc85d
-			reg_num, reg_offset, buf_offset, length);
7bc85d
+			"xfer $%d, reg offset %d, buf offset %s, length %d, ",
7bc85d
+			reg_num, reg_offset, plongest (buf_offset), length);
7bc85d
   if (mips_debug && out != NULL)
7bc85d
     {
7bc85d
       int i;
7bc85d
@@ -4543,13 +4543,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
       gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE];
7bc85d
       struct value *arg = args[argnum];
7bc85d
       struct type *arg_type = check_typedef (value_type (arg));
7bc85d
-      int len = TYPE_LENGTH (arg_type);
7bc85d
+      LONGEST len = TYPE_LENGTH (arg_type);
7bc85d
       enum type_code typecode = TYPE_CODE (arg_type);
7bc85d
 
7bc85d
       if (mips_debug)
7bc85d
 	fprintf_unfiltered (gdb_stdlog,
7bc85d
-			    "mips_eabi_push_dummy_call: %d len=%d type=%d",
7bc85d
-			    argnum + 1, len, (int) typecode);
7bc85d
+			    "mips_eabi_push_dummy_call: %d len=%s type=%d",
7bc85d
+			    argnum + 1, plongest (len), (int) typecode);
7bc85d
 
7bc85d
       /* The EABI passes structures that do not fit in a register by
7bc85d
          reference.  */
7bc85d
@@ -4819,7 +4819,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
7bc85d
 
7bc85d
 static int
7bc85d
 mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
7bc85d
-			    int offset)
7bc85d
+			    LONGEST offset)
7bc85d
 {
7bc85d
   int i;
7bc85d
 
7bc85d
@@ -4834,7 +4834,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
7bc85d
 
7bc85d
   for (i = 0; i < TYPE_NFIELDS (arg_type); i++)
7bc85d
     {
7bc85d
-      int pos;
7bc85d
+      LONGEST pos;
7bc85d
       struct type *field_type;
7bc85d
 
7bc85d
       /* We're only looking at normal fields.  */
7bc85d
@@ -4876,7 +4876,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   int argreg;
7bc85d
   int float_argreg;
7bc85d
   int argnum;
7bc85d
-  int len = 0;
7bc85d
+  LONGEST len = 0;
7bc85d
   int stack_offset = 0;
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   CORE_ADDR func_addr = find_function_addr (function, NULL);
7bc85d
@@ -5227,11 +5227,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
7bc85d
 				: MIPS_V0_REGNUM);
7bc85d
 	   field < TYPE_NFIELDS (type); field++, regnum += 2)
7bc85d
 	{
7bc85d
-	  int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
7bc85d
-			/ TARGET_CHAR_BIT);
7bc85d
+	  LONGEST offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
7bc85d
+			    / TARGET_CHAR_BIT);
7bc85d
 	  if (mips_debug)
7bc85d
-	    fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
7bc85d
-				offset);
7bc85d
+	    fprintf_unfiltered (gdb_stderr, "Return float struct+%s\n",
7bc85d
+				plongest (offset));
7bc85d
 	  if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16)
7bc85d
 	    {
7bc85d
 	      /* A 16-byte long double field goes in two consecutive
7bc85d
@@ -5273,8 +5273,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
7bc85d
 	  if (offset + xfer > TYPE_LENGTH (type))
7bc85d
 	    xfer = TYPE_LENGTH (type) - offset;
7bc85d
 	  if (mips_debug)
7bc85d
-	    fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n",
7bc85d
-				offset, xfer, regnum);
7bc85d
+	    fprintf_unfiltered (gdb_stderr, "Return struct+%s:%d in $%d\n",
7bc85d
+				plongest (offset), xfer, regnum);
7bc85d
 	  mips_xfer_register (gdbarch, regcache,
7bc85d
 			      gdbarch_num_regs (gdbarch) + regnum,
7bc85d
 			      xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf,
7bc85d
@@ -5332,7 +5332,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   int argreg;
7bc85d
   int float_argreg;
7bc85d
   int argnum;
7bc85d
-  int len = 0;
7bc85d
+  LONGEST len = 0;
7bc85d
   int stack_offset = 0;
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   CORE_ADDR func_addr = find_function_addr (function, NULL);
7bc85d
@@ -5396,13 +5396,13 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
       const gdb_byte *val;
7bc85d
       struct value *arg = args[argnum];
7bc85d
       struct type *arg_type = check_typedef (value_type (arg));
7bc85d
-      int len = TYPE_LENGTH (arg_type);
7bc85d
+      LONGEST len = TYPE_LENGTH (arg_type);
7bc85d
       enum type_code typecode = TYPE_CODE (arg_type);
7bc85d
 
7bc85d
       if (mips_debug)
7bc85d
 	fprintf_unfiltered (gdb_stdlog,
7bc85d
-			    "mips_o32_push_dummy_call: %d len=%d type=%d",
7bc85d
-			    argnum + 1, len, (int) typecode);
7bc85d
+			    "mips_o32_push_dummy_call: %d len=%s type=%d",
7bc85d
+			    argnum + 1, plongest (len), (int) typecode);
7bc85d
 
7bc85d
       val = value_contents (arg);
7bc85d
 
7bc85d
@@ -5856,8 +5856,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   int argreg;
7bc85d
   int float_argreg;
7bc85d
   int argnum;
7bc85d
-  int len = 0;
7bc85d
-  int stack_offset = 0;
7bc85d
+  LONGEST len = 0;
7bc85d
+  LONGEST stack_offset = 0;
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   CORE_ADDR func_addr = find_function_addr (function, NULL);
7bc85d
 
7bc85d
@@ -5917,13 +5917,13 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
       const gdb_byte *val;
7bc85d
       struct value *arg = args[argnum];
7bc85d
       struct type *arg_type = check_typedef (value_type (arg));
7bc85d
-      int len = TYPE_LENGTH (arg_type);
7bc85d
+      LONGEST len = TYPE_LENGTH (arg_type);
7bc85d
       enum type_code typecode = TYPE_CODE (arg_type);
7bc85d
 
7bc85d
       if (mips_debug)
7bc85d
 	fprintf_unfiltered (gdb_stdlog,
7bc85d
-			    "mips_o64_push_dummy_call: %d len=%d type=%d",
7bc85d
-			    argnum + 1, len, (int) typecode);
7bc85d
+			    "mips_o64_push_dummy_call: %d len=%s type=%d",
7bc85d
+			    argnum + 1, plongest (len), (int) typecode);
7bc85d
 
7bc85d
       val = value_contents (arg);
7bc85d
 
7bc85d
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
7bc85d
--- a/gdb/mn10300-tdep.c
7bc85d
+++ b/gdb/mn10300-tdep.c
7bc85d
@@ -1197,7 +1197,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   const int push_size = register_size (gdbarch, E_PC_REGNUM);
7bc85d
   int regs_used;
7bc85d
-  int len, arg_len; 
7bc85d
+  LONGEST len, arg_len; 
7bc85d
   int stack_offset = 0;
7bc85d
   int argnum;
7bc85d
   const gdb_byte *val;
7bc85d
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
7bc85d
--- a/gdb/ppc-sysv-tdep.c
7bc85d
+++ b/gdb/ppc-sysv-tdep.c
7bc85d
@@ -68,7 +68,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
7bc85d
   ULONGEST saved_sp;
7bc85d
-  int argspace = 0;		/* 0 is an initial wrong guess.  */
7bc85d
+  LONGEST argspace = 0;		/* 0 is an initial wrong guess.  */
7bc85d
   int write_pass;
7bc85d
 
7bc85d
   gdb_assert (tdep->wordsize == 4);
7bc85d
@@ -99,9 +99,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
       /* Next available vector register for vector arguments.  */
7bc85d
       int vreg = 2;
7bc85d
       /* Arguments start above the "LR save word" and "Back chain".  */
7bc85d
-      int argoffset = 2 * tdep->wordsize;
7bc85d
+      LONGEST argoffset = 2 * tdep->wordsize;
7bc85d
       /* Structures start after the arguments.  */
7bc85d
-      int structoffset = argoffset + argspace;
7bc85d
+      LONGEST structoffset = argoffset + argspace;
7bc85d
 
7bc85d
       /* If the function is returning a `struct', then the first word
7bc85d
          (which will be passed in r3) is used for struct return
7bc85d
@@ -120,7 +120,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 	{
7bc85d
 	  struct value *arg = args[argno];
7bc85d
 	  struct type *type = check_typedef (value_type (arg));
7bc85d
-	  int len = TYPE_LENGTH (type);
7bc85d
+	  ssize_t len = TYPE_LENGTH (type);
7bc85d
 	  const bfd_byte *val = value_contents (arg);
7bc85d
 
7bc85d
 	  if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8
7bc85d
@@ -1246,11 +1246,11 @@ struct ppc64_sysv_argpos
7bc85d
 
7bc85d
 static void
7bc85d
 ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
7bc85d
-			 const bfd_byte *val, int len, int align,
7bc85d
+			 const bfd_byte *val, ssize_t len, int align,
7bc85d
 			 struct ppc64_sysv_argpos *argpos)
7bc85d
 {
7bc85d
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7bc85d
-  int offset = 0;
7bc85d
+  LONGEST offset = 0;
7bc85d
 
7bc85d
   /* Enforce alignment of stack location, if requested.  */
7bc85d
   if (align > tdep->wordsize)
7bc85d
@@ -1287,7 +1287,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
7bc85d
     {
7bc85d
       if (argpos->regcache && argpos->greg <= 10)
7bc85d
 	argpos->regcache->cooked_write_part
7bc85d
-	  (tdep->ppc_gp0_regnum + argpos->greg, offset, len, val);
7bc85d
+	  (tdep->ppc_gp0_regnum + argpos->greg, offset, (LONGEST) len, val);
7bc85d
       argpos->greg++;
7bc85d
     }
7bc85d
 }
7bc85d
@@ -1346,7 +1346,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
7bc85d
       if (argpos->regcache && argpos->freg <= 13)
7bc85d
 	{
7bc85d
 	  int regnum = tdep->ppc_fp0_regnum + argpos->freg;
7bc85d
-	  int offset = 0;
7bc85d
+	  LONGEST offset = 0;
7bc85d
 
7bc85d
 	  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
7bc85d
 	    offset = 8 - TYPE_LENGTH (type);
7bc85d
@@ -1795,7 +1795,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
7bc85d
       && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
7bc85d
     {
7bc85d
       int regnum = tdep->ppc_fp0_regnum + 1 + index;
7bc85d
-      int offset = 0;
7bc85d
+      LONGEST offset = 0;
7bc85d
 
7bc85d
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
7bc85d
 	offset = 8 - TYPE_LENGTH (valtype);
7bc85d
@@ -1871,7 +1871,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
7bc85d
       && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype))
7bc85d
     {
7bc85d
       int regnum = tdep->ppc_gp0_regnum + 3 + index;
7bc85d
-      int offset = 0;
7bc85d
+      LONGEST offset = 0;
7bc85d
 
7bc85d
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
7bc85d
 	offset = 8 - TYPE_LENGTH (valtype);
7bc85d
@@ -1979,7 +1979,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
7bc85d
       && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
7bc85d
     {
7bc85d
       int regnum = tdep->ppc_gp0_regnum + 3;
7bc85d
-      int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));
7bc85d
+      LONGEST offset
7bc85d
+	= (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype));
7bc85d
 
7bc85d
       if (writebuf != NULL)
7bc85d
 	regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype),
7bc85d
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
7bc85d
--- a/gdb/rl78-tdep.c
7bc85d
+++ b/gdb/rl78-tdep.c
7bc85d
@@ -1346,8 +1346,8 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   for (i = nargs - 1; i >= 0; i--)
7bc85d
     {
7bc85d
       struct type *value_type = value_enclosing_type (args[i]);
7bc85d
-      int len = TYPE_LENGTH (value_type);
7bc85d
-      int container_len = (len + 1) & ~1;
7bc85d
+      LONGEST len = TYPE_LENGTH (value_type);
7bc85d
+      LONGEST container_len = (len + 1) & ~1;
7bc85d
 
7bc85d
       sp -= container_len;
7bc85d
       write_memory (rl78_make_data_address (sp),
7bc85d
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
7bc85d
--- a/gdb/rs6000-aix-tdep.c
7bc85d
+++ b/gdb/rs6000-aix-tdep.c
7bc85d
@@ -177,9 +177,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int ii;
7bc85d
-  int len = 0;
7bc85d
+  LONGEST len = 0;
7bc85d
   int argno;			/* current argument number */
7bc85d
-  int argbytes;			/* current argument byte */
7bc85d
+  LONGEST argbytes;		/* current argument byte */
7bc85d
   gdb_byte tmp_buffer[50];
7bc85d
   int f_argno = 0;		/* current floating point argno */
7bc85d
   int wordsize = gdbarch_tdep (gdbarch)->wordsize;
7bc85d
@@ -307,7 +307,7 @@ ran_out_of_registers_for_arguments:
7bc85d
 
7bc85d
   if ((argno < nargs) || argbytes)
7bc85d
     {
7bc85d
-      int space = 0, jj;
7bc85d
+      LONGEST space = 0, jj;
7bc85d
 
7bc85d
       if (argbytes)
7bc85d
 	{
7bc85d
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
7bc85d
--- a/gdb/score-tdep.c
7bc85d
+++ b/gdb/score-tdep.c
7bc85d
@@ -516,7 +516,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int argnum;
7bc85d
   int argreg;
7bc85d
-  int arglen = 0;
7bc85d
+  LONGEST arglen = 0;
7bc85d
   CORE_ADDR stack_offset = 0;
7bc85d
   CORE_ADDR addr = 0;
7bc85d
 
7bc85d
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
7bc85d
--- a/gdb/sh-tdep.c
7bc85d
+++ b/gdb/sh-tdep.c
7bc85d
@@ -812,7 +812,7 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
7bc85d
 static int
7bc85d
 sh_use_struct_convention (int renesas_abi, struct type *type)
7bc85d
 {
7bc85d
-  int len = TYPE_LENGTH (type);
7bc85d
+  LONGEST len = TYPE_LENGTH (type);
7bc85d
   int nelem = TYPE_NFIELDS (type);
7bc85d
 
7bc85d
   /* The Renesas ABI returns aggregate types always on stack.  */
7bc85d
@@ -914,7 +914,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp)
7bc85d
 
7bc85d
 /* Helper function to justify value in register according to endianess.  */
7bc85d
 static const gdb_byte *
7bc85d
-sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len)
7bc85d
+sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, LONGEST len)
7bc85d
 {
7bc85d
   static gdb_byte valbuf[4];
7bc85d
 
7bc85d
@@ -1074,7 +1074,8 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
7bc85d
   struct type *type;
7bc85d
   CORE_ADDR regval;
7bc85d
   const gdb_byte *val;
7bc85d
-  int len, reg_size = 0;
7bc85d
+  LONGEST len;
7bc85d
+  int reg_size = 0;
7bc85d
   int pass_on_stack = 0;
7bc85d
   int treat_as_flt;
7bc85d
   int last_reg_arg = INT_MAX;
7bc85d
@@ -1215,7 +1216,8 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
7bc85d
   struct type *type;
7bc85d
   CORE_ADDR regval;
7bc85d
   const gdb_byte *val;
7bc85d
-  int len, reg_size = 0;
7bc85d
+  LONGEST len;
7bc85d
+  int reg_size = 0;
7bc85d
   int pass_on_stack = 0;
7bc85d
   int last_reg_arg = INT_MAX;
7bc85d
 
7bc85d
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
7bc85d
--- a/gdb/sparc64-tdep.c
7bc85d
+++ b/gdb/sparc64-tdep.c
7bc85d
@@ -1205,7 +1205,7 @@ sparc64_16_byte_align_p (struct type *type)
7bc85d
 
7bc85d
 static void
7bc85d
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
7bc85d
-			       const gdb_byte *valbuf, int element, int bitpos)
7bc85d
+			       const gdb_byte *valbuf, int element, LONGEST bitpos)
7bc85d
 {
7bc85d
   struct gdbarch *gdbarch = regcache->arch ();
7bc85d
   int len = TYPE_LENGTH (type);
7bc85d
@@ -1265,7 +1265,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
7bc85d
       for (i = 0; i < TYPE_NFIELDS (type); i++)
7bc85d
 	{
7bc85d
 	  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
7bc85d
-	  int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
7bc85d
+	  LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
7bc85d
 
7bc85d
 	  sparc64_store_floating_fields (regcache, subtype, valbuf,
7bc85d
 					 element, subpos);
7bc85d
@@ -1297,7 +1297,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
7bc85d
 
7bc85d
 static void
7bc85d
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
7bc85d
-				 gdb_byte *valbuf, int bitpos)
7bc85d
+				 gdb_byte *valbuf, LONGEST bitpos)
7bc85d
 {
7bc85d
   struct gdbarch *gdbarch = regcache->arch ();
7bc85d
 
7bc85d
@@ -1353,7 +1353,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
7bc85d
       for (i = 0; i < TYPE_NFIELDS (type); i++)
7bc85d
 	{
7bc85d
 	  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
7bc85d
-	  int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
7bc85d
+	  LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
7bc85d
 
7bc85d
 	  sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
7bc85d
 	}
7bc85d
@@ -1386,7 +1386,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
7bc85d
   for (i = 0; i < nargs; i++)
7bc85d
     {
7bc85d
       struct type *type = value_type (args[i]);
7bc85d
-      int len = TYPE_LENGTH (type);
7bc85d
+      LONGEST len = TYPE_LENGTH (type);
7bc85d
 
7bc85d
       if (sparc64_structure_or_union_p (type)
7bc85d
 	  || (sparc64_complex_floating_p (type) && len == 32))
7bc85d
@@ -1486,7 +1486,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
7bc85d
     {
7bc85d
       const gdb_byte *valbuf = value_contents (args[i]);
7bc85d
       struct type *type = value_type (args[i]);
7bc85d
-      int len = TYPE_LENGTH (type);
7bc85d
+      LONGEST len = TYPE_LENGTH (type);
7bc85d
       int regnum = -1;
7bc85d
       gdb_byte buf[16];
7bc85d
 
7bc85d
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
7bc85d
--- a/gdb/spu-tdep.c
7bc85d
+++ b/gdb/spu-tdep.c
7bc85d
@@ -1431,7 +1431,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
       struct value *arg = args[i];
7bc85d
       struct type *type = check_typedef (value_type (arg));
7bc85d
       const gdb_byte *contents = value_contents (arg);
7bc85d
-      int n_regs = align_up (TYPE_LENGTH (type), 16) / 16;
7bc85d
+      LONGEST n_regs = align_up (TYPE_LENGTH (type), 16) / 16;
7bc85d
 
7bc85d
       /* If the argument doesn't wholly fit into registers, it and
7bc85d
 	 all subsequent arguments go to the stack.  */
7bc85d
@@ -1463,7 +1463,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 	{
7bc85d
 	  struct value *arg = args[i];
7bc85d
 	  struct type *type = check_typedef (value_type (arg));
7bc85d
-	  int len = TYPE_LENGTH (type);
7bc85d
+	  LONGEST len = TYPE_LENGTH (type);
7bc85d
 	  int preferred_slot;
7bc85d
 	  
7bc85d
 	  if (spu_scalar_value_p (type))
7bc85d
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
7bc85d
--- a/gdb/tic6x-tdep.c
7bc85d
+++ b/gdb/tic6x-tdep.c
7bc85d
@@ -881,7 +881,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   int argreg = 0;
7bc85d
   int argnum;
7bc85d
   int stack_offset = 4;
7bc85d
-  int references_offset = 4;
7bc85d
+  LONGEST references_offset = 4;
7bc85d
   CORE_ADDR func_addr = find_function_addr (function, NULL);
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   struct type *func_type = value_type (function);
7bc85d
@@ -915,7 +915,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
   /* Now make space on the stack for the args.  */
7bc85d
   for (argnum = 0; argnum < nargs; argnum++)
7bc85d
     {
7bc85d
-      int len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
7bc85d
+      LONGEST len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
7bc85d
       if (argnum >= 10 - argreg)
7bc85d
 	references_offset += len;
7bc85d
       stack_offset += len;
7bc85d
@@ -934,7 +934,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
       const gdb_byte *val;
7bc85d
       struct value *arg = args[argnum];
7bc85d
       struct type *arg_type = check_typedef (value_type (arg));
7bc85d
-      int len = TYPE_LENGTH (arg_type);
7bc85d
+      ssize_t len = TYPE_LENGTH (arg_type);
7bc85d
       enum type_code typecode = TYPE_CODE (arg_type);
7bc85d
 
7bc85d
       val = value_contents (arg);
7bc85d
@@ -1090,7 +1090,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
7bc85d
 	    }
7bc85d
 	  else
7bc85d
 	    internal_error (__FILE__, __LINE__,
7bc85d
-			    _("unexpected length %d of arg %d"), len, argnum);
7bc85d
+			    _("unexpected length %s of arg %d"),
7bc85d
+			    plongest (len), argnum);
7bc85d
 
7bc85d
 	  addr = sp + stack_offset;
7bc85d
 	  write_memory (addr, val, len);
7bc85d
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
7bc85d
--- a/gdb/tilegx-tdep.c
7bc85d
+++ b/gdb/tilegx-tdep.c
7bc85d
@@ -288,7 +288,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
   CORE_ADDR stack_dest = sp;
7bc85d
   int argreg = TILEGX_R0_REGNUM;
7bc85d
   int i, j;
7bc85d
-  int typelen, slacklen;
7bc85d
+  LONGEST typelen, slacklen;
7bc85d
   static const gdb_byte four_zero_words[16] = { 0 };
7bc85d
 
7bc85d
   /* If struct_return is 1, then the struct return address will
7bc85d
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
7bc85d
--- a/gdb/v850-tdep.c
7bc85d
+++ b/gdb/v850-tdep.c
7bc85d
@@ -1019,7 +1019,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int argreg;
7bc85d
   int argnum;
7bc85d
-  int len = 0;
7bc85d
+  LONGEST len = 0;
7bc85d
   int stack_offset;
7bc85d
 
7bc85d
   if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850)
7bc85d
@@ -1047,7 +1047,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
      in four registers available.  Loop thru args from first to last.  */
7bc85d
   for (argnum = 0; argnum < nargs; argnum++)
7bc85d
     {
7bc85d
-      int len;
7bc85d
+      LONGEST len;
7bc85d
       gdb_byte *val;
7bc85d
       gdb_byte valbuf[v850_reg_size];
7bc85d
 
7bc85d
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
7bc85d
--- a/gdb/vax-tdep.c
7bc85d
+++ b/gdb/vax-tdep.c
7bc85d
@@ -110,7 +110,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
7bc85d
   struct gdbarch *gdbarch = regcache->arch ();
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   gdb_byte buf[4];
7bc85d
-  int count = 0;
7bc85d
+  LONGEST count = 0;
7bc85d
   int i;
7bc85d
 
7bc85d
   /* We create an argument list on the stack, and make the argument
7bc85d
@@ -119,7 +119,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
7bc85d
   /* Push arguments in reverse order.  */
7bc85d
   for (i = nargs - 1; i >= 0; i--)
7bc85d
     {
7bc85d
-      int len = TYPE_LENGTH (value_enclosing_type (args[i]));
7bc85d
+      LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i]));
7bc85d
 
7bc85d
       sp -= (len + 3) & ~3;
7bc85d
       count += (len + 3) / 4;
7bc85d
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
7bc85d
--- a/gdb/xstormy16-tdep.c
7bc85d
+++ b/gdb/xstormy16-tdep.c
7bc85d
@@ -232,8 +232,9 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   CORE_ADDR stack_dest = sp;
7bc85d
   int argreg = E_1ST_ARG_REGNUM;
7bc85d
-  int i, j;
7bc85d
-  int typelen, slacklen;
7bc85d
+  int i, slacklen;
7bc85d
+  LONGEST j;
7bc85d
+  LONGEST typelen;
7bc85d
   const gdb_byte *val;
7bc85d
   gdb_byte buf[xstormy16_pc_size];
7bc85d
 
7bc85d
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
7bc85d
--- a/gdb/xtensa-tdep.c
7bc85d
+++ b/gdb/xtensa-tdep.c
7bc85d
@@ -1626,8 +1626,7 @@ xtensa_store_return_value (struct type *type,
7bc85d
 
7bc85d
       if (len > (callsize > 8 ? 8 : 16))
7bc85d
 	internal_error (__FILE__, __LINE__,
7bc85d
-			_("unimplemented for this length: %d"),
7bc85d
-			TYPE_LENGTH (type));
7bc85d
+			_("unimplemented for this length: %d"), len);
7bc85d
       areg = arreg_number (gdbarch,
7bc85d
 			   gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
7bc85d
 
7bc85d
@@ -1701,18 +1700,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
 {
7bc85d
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
7bc85d
   int i;
7bc85d
-  int size, onstack_size;
7bc85d
+  LONGEST size, onstack_size;
7bc85d
   gdb_byte *buf = (gdb_byte *) alloca (16);
7bc85d
   CORE_ADDR ra, ps;
7bc85d
   struct argument_info
7bc85d
   {
7bc85d
     const bfd_byte *contents;
7bc85d
-    int length;
7bc85d
+    ssize_t length;
7bc85d
     int onstack;		/* onstack == 0 => in reg */
7bc85d
     int align;			/* alignment */
7bc85d
     union
7bc85d
     {
7bc85d
-      int offset;		/* stack offset if on stack.  */
7bc85d
+      ssize_t offset;		/* stack offset if on stack.  */
7bc85d
       int regno;		/* regno if in register.  */
7bc85d
     } u;
7bc85d
   };
7bc85d
@@ -1736,9 +1735,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
         {
7bc85d
 	  struct value *arg = args[i];
7bc85d
 	  struct type *arg_type = check_typedef (value_type (arg));
7bc85d
-	  fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i,
7bc85d
-			      host_address_to_string (arg),
7bc85d
-			      TYPE_LENGTH (arg_type));
7bc85d
+	  const char *arg_type_len_s = pulongest (TYPE_LENGTH (arg_type));
7bc85d
+
7bc85d
+	  fprintf_unfiltered (gdb_stdlog, "%2d: %s %s ", i,
7bc85d
+			      host_address_to_string (arg), arg_type_len_s);
7bc85d
 	  switch (TYPE_CODE (arg_type))
7bc85d
 	    {
7bc85d
 	    case TYPE_CODE_INT:
7bc85d
@@ -1808,8 +1808,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
 	  info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long);
7bc85d
 	  break;
7bc85d
 	}
7bc85d
-      info->length = TYPE_LENGTH (arg_type);
7bc85d
       info->contents = value_contents (arg);
7bc85d
+      info->length = TYPE_LENGTH (arg_type);
7bc85d
 
7bc85d
       /* Align size and onstack_size.  */
7bc85d
       size = (size + info->align - 1) & ~(info->align - 1);
7bc85d
@@ -1854,7 +1854,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
 
7bc85d
       if (info->onstack)
7bc85d
 	{
7bc85d
-	  int n = info->length;
7bc85d
+	  ssize_t n = info->length;
7bc85d
 	  CORE_ADDR offset = sp + info->u.offset;
7bc85d
 
7bc85d
 	  /* Odd-sized structs are aligned to the lower side of a memory
7bc85d
@@ -1870,7 +1870,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
7bc85d
 	}
7bc85d
       else
7bc85d
 	{
7bc85d
-	  int n = info->length;
7bc85d
+	  ssize_t n = info->length;
7bc85d
 	  const bfd_byte *cp = info->contents;
7bc85d
 	  int r = info->u.regno;
7bc85d