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

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