gas md_number_to_chars

Alan Modra amodra@gmail.com
Wed Jul 9 00:01:16 GMT 2025


Calls to md_number_to_chars don't need to cast their value arg (*).
Remove those casts.  avr_output_property_recode made a call to
md_number_to_chars with size of 1.  Simplify that.  tc-bpf.c
md_convert_frag used write_insn_bytes that simply copied input to
output.  Dispense with that nonsense, and similarly in a couple of
other places where md_number_to_chars was called with size 1.

*) unless the value arg is an expression that needs a cast, eg. tic54x
   emit_insn where the shift left could trigger signed overflow UB
   without a cast.

diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c
index b03919e5cb0..92b9f74d4f3 100644
--- a/gas/config/atof-ieee.c
+++ b/gas/config/atof-ieee.c
@@ -553,7 +553,7 @@ gen_to_words (LITTLENUM_TYPE *words, int precision, long exponent_bits)
 	      tmp_bits = prec_bits;
 	      while (tmp_bits > LITTLENUM_NUMBER_OF_BITS)
 		{
-		  if (lp[n] != (LITTLENUM_TYPE) - 1)
+		  if (lp[n] != (LITTLENUM_TYPE) -1)
 		    break;
 		  --n;
 		  tmp_bits -= LITTLENUM_NUMBER_OF_BITS;
@@ -835,17 +835,17 @@ ieee_md_atof (int type,
 
   if (big_wordian)
     {
-      for (wordP = words; prec --;)
+      for (wordP = words; prec--;)
 	{
-	  md_number_to_chars (litP, (valueT) (* wordP ++), sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, *wordP++, sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
   else
     {
-      for (wordP = words + prec; prec --;)
+      for (wordP = words + prec; prec--;)
 	{
-	  md_number_to_chars (litP, (valueT) (* -- wordP), sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, *--wordP, sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 98b93e6e489..99f4bc6ae6e 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -4586,7 +4586,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
       *(p + 3) = alpha_evax_proc->ra_save;
       break;
     case PDSC_S_K_KIND_FP_STACK:
-      md_number_to_chars (p + 2, (valueT) alpha_evax_proc->rsa_offset, 2);
+      md_number_to_chars (p + 2, alpha_evax_proc->rsa_offset, 2);
       break;
     default:		/* impossible */
       break;
@@ -4596,7 +4596,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
   *(p + 5) = alpha_evax_proc->type & 0x0f;
 
   /* Signature offset.  */
-  md_number_to_chars (p + 6, (valueT) 0, 2);
+  md_number_to_chars (p + 6, 0, 2);
 
   fix_new_exp (frag_now, p - frag_now->fr_literal + 8,
                8, &exp, 0, BFD_RELOC_64);
@@ -4606,8 +4606,8 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
 
   /* pdesc+16: Size.  */
   p = frag_more (6);
-  md_number_to_chars (p, (valueT) alpha_evax_proc->framesize, 4);
-  md_number_to_chars (p + 4, (valueT) 0, 2);
+  md_number_to_chars (p, alpha_evax_proc->framesize, 4);
+  md_number_to_chars (p + 4, 0, 2);
 
   /* Entry length.  */
   exp.X_op = O_subtract;
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index 62f01bc4940..6b78966d80a 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -2190,8 +2190,7 @@ avr_output_property_record (char * const frag_base, char *frag_ptr,
   fix->fx_line = 0;
   frag_ptr += 4;
 
-  md_number_to_chars (frag_ptr, (bfd_byte) record->type, 1);
-  frag_ptr += 1;
+  *frag_ptr++ = record->type & 0xff;
 
   /* Write out the rest of the data.  */
   switch (record->type)
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index 5ba2bbd16c3..fd77c6fda65 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -516,17 +516,6 @@ encode_int32 (int32_t value, char *buffer)
     }
 }
 
-/* Write a BPF instruction to BUF.  */
-
-static void
-write_insn_bytes (bfd_byte *buf, char *bytes)
-{
-  int i;
-
-  for (i = 0; i < 8; ++i)
-    md_number_to_chars ((char *) buf + i, (valueT) bytes[i], 1);
-}
-
 /* *FRAGP has been relaxed to its final size, and now needs to have
    the bytes inside it modified to conform to the new size.
 
@@ -625,13 +614,14 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
             {
               /* 16-bit disp is known and not in range.  Turn the JA
                  into a JAL with a 32-bit displacement.  */
-              char bytes[8] = {0};
-
-              bytes[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
-              bytes[1] = (word >> 48) & 0xff;
-              bytes[2] = 0; /* disp16 high */
-              bytes[3] = 0; /* disp16 lo */
-              write_insn_bytes (buf, bytes);
+	      buf[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
+	      buf[1] = (word >> 48) & 0xff;
+	      buf[2] = 0; /* disp16 high */
+	      buf[3] = 0; /* disp16 lo */
+	      buf[4] = 0;
+	      buf[5] = 0;
+	      buf[6] = 0;
+	      buf[7] = 0;
 
               /* Install fixup for the JAL.  */
               reloc_howto_type *reloc_howto
@@ -713,8 +703,6 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
               /* 16-bit disp is known and not in range.  Turn the JXX
                  into a sequence JXX +1; JA +1; JAL d32.  */
 
-              char bytes[8];
-
               /* First, set the 16-bit offset in the current
                  instruction to 1.  */
 
@@ -726,24 +714,25 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
 
               /* Then, write the JA + 1  */
 
-              bytes[0] = 0x05; /* JA */
-              bytes[1] = 0x0;
-              encode_int16 (1, bytes + 2);
-              bytes[4] = 0x0;
-              bytes[5] = 0x0;
-              bytes[6] = 0x0;
-              bytes[7] = 0x0;
-              write_insn_bytes (buf, bytes);
+	      buf[0] = 0x05; /* JA */
+	      buf[1] = 0x0;
+	      encode_int16 (1, (char *) buf + 2);
+	      buf[4] = 0x0;
+	      buf[5] = 0x0;
+	      buf[6] = 0x0;
+	      buf[7] = 0x0;
               buf += 8;
 
               /* Finally, write the JAL to the target. */
 
-              bytes[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
-              bytes[1] = 0;
-              bytes[2] = 0;
-              bytes[3] = 0;
-              encode_int32 ((int32_t) 0, bytes + 4);
-              write_insn_bytes (buf, bytes);
+	      buf[0] = ((BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K) >> 56) & 0xff;
+	      buf[1] = 0;
+	      buf[2] = 0;
+	      buf[3] = 0;
+	      buf[4] = 0;
+	      buf[5] = 0;
+	      buf[6] = 0;
+	      buf[7] = 0;
 
               /* Install fixup for the JAL.  */
               reloc_howto_type *reloc_howto
@@ -870,14 +859,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 	  md_number_to_chars (where, *valP, 8);
 	  break;
         case BFD_RELOC_BPF_DISP16:
-          md_number_to_chars (where + 2, (uint16_t) *valP, 2);
+	  md_number_to_chars (where + 2, *valP, 2);
           break;
         case BFD_RELOC_BPF_DISP32:
         case BFD_RELOC_BPF_DISPCALL32:
-          md_number_to_chars (where + 4, (uint32_t) *valP, 4);
+	  md_number_to_chars (where + 4, *valP, 4);
           break;
         case BFD_RELOC_16_PCREL:
-          md_number_to_chars (where + 2, (uint32_t) *valP, 2);
+	  md_number_to_chars (where + 2, *valP, 2);
           break;
 	default:
 	  as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -1195,13 +1184,11 @@ add_fixed_insn (struct bpf_insn *insn)
 {
   char *this_frag = frag_more (insn->size);
   char bytes[16];
-  int i;
 
   /* First encode the known parts of the instruction, including
      opcodes and constant immediates, and write them to the frag.  */
   encode_insn (insn, bytes, 0 /* relax */);
-  for (i = 0; i < insn->size; ++i)
-    md_number_to_chars (this_frag + i, (valueT) bytes[i], 1);
+  memcpy (this_frag, bytes, insn->size);
 
   /* Now install the instruction fixups.  */
   install_insn_fixups (insn, frag_now,
@@ -1214,7 +1201,6 @@ static void
 add_relaxed_insn (struct bpf_insn *insn, expressionS *exp)
 {
   char bytes[16];
-  int i;
   char *this_frag;
   unsigned worst_case = relaxed_branch_length (NULL, NULL, 0);
   unsigned best_case = insn->size;
@@ -1231,8 +1217,7 @@ add_relaxed_insn (struct bpf_insn *insn, expressionS *exp)
   /* First encode the known parts of the instruction, including
      opcodes and constant immediates, and write them to the frag.  */
   encode_insn (insn, bytes, 1 /* relax */);
-  for (i = 0; i < insn->size; ++i)
-    md_number_to_chars (this_frag + i, (valueT) bytes[i], 1);
+  memcpy (this_frag, bytes, insn->size);
 
   /* Note that instruction fixups will be applied once the frag is
      relaxed, in md_convert_frag.  */
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 20c108f5e45..4bbab7f2dee 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -2456,7 +2456,7 @@ print_insn (ins *insn)
   /* Write the instruction encoding to frag.  */
   for (i = 0; i < insn_size; i++)
     {
-      md_number_to_chars (this_frag, (valueT) words[i], 2);
+      md_number_to_chars (this_frag, words[i], 2);
       this_frag += 2;
     }
 }
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index a7ac4efba3b..ed91d06c177 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -1274,7 +1274,7 @@ md_assemble (char *str)
       opcodep = cris_insn_first_word_frag ();
 
       /* Output the prefix opcode.  */
-      md_number_to_chars (opcodep, (long) prefix.opcode, 2);
+      md_number_to_chars (opcodep, prefix.opcode, 2);
 
       /* Having a specified reloc only happens for DIP and for BDAP with
 	 PIC or TLS operands, but it is ok to drop through here for the other
@@ -1324,7 +1324,7 @@ md_assemble (char *str)
     opcodep = frag_more (2);
 
   /* Output the instruction opcode.  */
-  md_number_to_chars (opcodep, (long) (output_instruction.opcode), 2);
+  md_number_to_chars (opcodep, output_instruction.opcode, 2);
 
   /* Output the symbol-dependent instruction stuff.  */
   if (output_instruction.insn_type == CRIS_INSN_BRANCH)
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index e57b660e89e..d5eb9db5ab8 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -1907,7 +1907,7 @@ print_insn (ins *insn)
   /* Write the instruction encoding to frag.  */
   for (i = 0; i < insn_size; i++)
     {
-      md_number_to_chars (this_frag, (valueT) words[i], 2);
+      md_number_to_chars (this_frag, words[i], 2);
       this_frag += 2;
     }
 }
diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c
index 6b514d3cbf0..55b74277cd1 100644
--- a/gas/config/tc-epiphany.c
+++ b/gas/config/tc-epiphany.c
@@ -942,7 +942,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
       fixP->fx_r_type = fixP->fx_cgen.opinfo;
     }
 
-  md_number_to_chars (displacement, (valueT) addend, extension + 1);
+  md_number_to_chars (displacement, addend, extension + 1);
 
   fragP->fr_fix += (extension & -2); /* 0,2 or 4 bytes added.  */
 }
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 5e0c0c1a9f0..532632ac8e9 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -16439,7 +16439,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED,
     }
   /* Now put displacement after opcode.  */
   md_number_to_chars ((char *) where_to_put_displacement,
-		      (valueT) (displacement_from_opcode_start - extension),
+		      displacement_from_opcode_start - extension,
 		      DISP_SIZE_FROM_RELAX_STATE (fragP->fr_subtype));
   fragP->fr_fix += extension;
 }
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index bb3eb67c72b..160661ac1bb 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -11663,8 +11663,7 @@ ia64_float_to_chars_bigendian (char *lit, LITTLENUM_TYPE *words,
 {
   while (prec--)
     {
-      number_to_chars_bigendian (lit, (long) (*words++),
-				 sizeof (LITTLENUM_TYPE));
+      number_to_chars_bigendian (lit, *words++, sizeof (LITTLENUM_TYPE));
       lit += sizeof (LITTLENUM_TYPE);
     }
 }
@@ -11675,7 +11674,7 @@ ia64_float_to_chars_littleendian (char *lit, LITTLENUM_TYPE *words,
 {
   while (prec--)
     {
-      number_to_chars_littleendian (lit, (long) (words[prec]),
+      number_to_chars_littleendian (lit, words[prec],
 				    sizeof (LITTLENUM_TYPE));
       lit += sizeof (LITTLENUM_TYPE);
     }
diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c
index d2e2226347f..241b5bee7a3 100644
--- a/gas/config/tc-lm32.c
+++ b/gas/config/tc-lm32.c
@@ -246,8 +246,7 @@ md_atof (int type, char *litP, int *sizeP)
     {
       for (i = 0; i < prec; i++)
 	{
-	  md_number_to_chars (litP, (valueT) words[i],
-			      sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
@@ -255,8 +254,7 @@ md_atof (int type, char *litP, int *sizeP)
     {
       for (i = prec - 1; i >= 0; i--)
 	{
-	  md_number_to_chars (litP, (valueT) words[i],
-			      sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c
index c367a8fca9c..968c88d629d 100644
--- a/gas/config/tc-metag.c
+++ b/gas/config/tc-metag.c
@@ -6736,8 +6736,7 @@ md_atof (int type, char * litP, int * sizeP)
 
   for (i = 0; i < prec; i++)
     {
-      md_number_to_chars (litP, (valueT) words[i],
-			  sizeof (LITTLENUM_TYPE));
+      md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
       litP += sizeof (LITTLENUM_TYPE);
     }
 
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 0e4cf7245c3..5e0eaa2170c 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -1872,17 +1872,15 @@ md_atof (int type, char * litP, int * sizeP)
     {
       for (i = prec - 1; i >= 0; i--)
         {
-          md_number_to_chars (litP, (valueT) words[i],
-                              sizeof (LITTLENUM_TYPE));
-          litP += sizeof (LITTLENUM_TYPE);
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
+	  litP += sizeof (LITTLENUM_TYPE);
         }
     }
   else
     for (i = 0; i < prec; i++)
       {
-        md_number_to_chars (litP, (valueT) words[i],
-                            sizeof (LITTLENUM_TYPE));
-        litP += sizeof (LITTLENUM_TYPE);
+	md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
+	litP += sizeof (LITTLENUM_TYPE);
       }
 
   return NULL;
diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c
index 3c4769921b6..2d5e112a4f2 100644
--- a/gas/config/tc-moxie.c
+++ b/gas/config/tc-moxie.c
@@ -590,7 +590,7 @@ md_atof (int type, char *litP, int *sizeP)
 
   for (i = prec - 1; i >= 0; i--)
     {
-      md_number_to_chars (litP, (valueT) words[i], 2);
+      md_number_to_chars (litP, words[i], 2);
       litP += 2;
     }
 
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 172132fcba6..3e138516074 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -7352,8 +7352,7 @@ md_atof (int type, char *litP, int *sizeP)
     {
       for (i = 0; i < prec; i++)
 	{
-	  md_number_to_chars (litP, (valueT) words[i],
-			      sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
@@ -7361,8 +7360,7 @@ md_atof (int type, char *litP, int *sizeP)
     {
       for (i = prec - 1; i >= 0; i--)
 	{
-	  md_number_to_chars (litP, (valueT) words[i],
-			      sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index 13907f26ad3..11e39280012 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -1577,13 +1577,13 @@ md_number_to_field (char *buf, long val, bit_fixS *field_ptr)
 #ifdef ENDIAN
       *mem_ptr = object;
 #else
-      mem_ptr[0] = (char) object;
+      mem_ptr[0] = object;
       object >>= 8;
-      mem_ptr[1] = (char) object;
+      mem_ptr[1] = object;
       object >>= 8;
-      mem_ptr[2] = (char) object;
+      mem_ptr[2] = object;
       object >>= 8;
-      mem_ptr[3] = (char) object;
+      mem_ptr[3] = object;
 #endif
     }
   else
@@ -1723,26 +1723,26 @@ convert_iif (void)
 			    {
 			    case 4:
 			      gen_to_words (words, 2, 8);
-			      md_number_to_imm (memP, (long) words[0],
+			      md_number_to_imm (memP, words[0],
 						sizeof (LITTLENUM_TYPE));
 			      md_number_to_imm (memP + sizeof (LITTLENUM_TYPE),
-						(long) words[1],
+						words[1],
 						sizeof (LITTLENUM_TYPE));
 			      break;
 			    case 8:
 			      gen_to_words (words, 4, 11);
-			      md_number_to_imm (memP, (long) words[0],
+			      md_number_to_imm (memP, words[0],
 						sizeof (LITTLENUM_TYPE));
 			      md_number_to_imm (memP + sizeof (LITTLENUM_TYPE),
-						(long) words[1],
+						words[1],
 						sizeof (LITTLENUM_TYPE));
 			      md_number_to_imm ((memP + 2
 						 * sizeof (LITTLENUM_TYPE)),
-						(long) words[2],
+						words[2],
 						sizeof (LITTLENUM_TYPE));
 			      md_number_to_imm ((memP + 3
 						 * sizeof (LITTLENUM_TYPE)),
-						(long) words[3],
+						words[3],
 						sizeof (LITTLENUM_TYPE));
 			      break;
 			    }
@@ -2035,7 +2035,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
   disp = (S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset) - object_address;
   disp += md_pcrel_adjust (fragP);
 
-  md_number_to_disp (buffer_address, (long) disp, (int) ext);
+  md_number_to_disp (buffer_address, disp, ext);
   fragP->fr_fix += ext;
 }
 
@@ -2093,8 +2093,8 @@ md_create_short_jump (char *ptr,
   valueT offset;
 
   offset = to_addr - from_addr;
-  md_number_to_chars (ptr, (valueT) 0xEA, 1);
-  md_number_to_disp (ptr + 1, (valueT) offset, 2);
+  *ptr++ = 0xEA;
+  md_number_to_disp (ptr, offset, 2);
 }
 
 void
@@ -2107,8 +2107,8 @@ md_create_long_jump (char *ptr,
   valueT offset;
 
   offset = to_addr - from_addr;
-  md_number_to_chars (ptr, (valueT) 0xEA, 1);
-  md_number_to_disp (ptr + 1, (valueT) offset, 4);
+  *ptr++ = 0xEA;
+  md_number_to_disp (ptr, offset, 4);
 }
 
 const char md_shortopts[] = "m:";
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 5eec9568107..93e7bf74a61 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1959,13 +1959,13 @@ ppc_cleanup (void)
     bfd_set_section_flags (apuinfo_secp, SEC_HAS_CONTENTS | SEC_READONLY);
 
     p = frag_more (4);
-    md_number_to_chars (p, (valueT) 8, 4);
+    md_number_to_chars (p, 8, 4);
 
     p = frag_more (4);
-    md_number_to_chars (p, (valueT) ppc_apuinfo_num * 4, 4);
+    md_number_to_chars (p, ppc_apuinfo_num * 4, 4);
 
     p = frag_more (4);
-    md_number_to_chars (p, (valueT) 2, 4);
+    md_number_to_chars (p, 2, 4);
 
     p = frag_more (8);
     strcpy (p, APUINFO_LABEL);
@@ -1973,7 +1973,7 @@ ppc_cleanup (void)
     for (i = 0; i < ppc_apuinfo_num; i++)
       {
 	p = frag_more (4);
-	md_number_to_chars (p, (valueT) ppc_apuinfo_list[i], 4);
+	md_number_to_chars (p, ppc_apuinfo_list[i], 4);
       }
 
     frag_align (2, 0, 0);
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index 10795a7de53..1c16ab3f986 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -5813,13 +5813,13 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED)
       exp.X_add_number = 0;
       emit_expr (&exp, 4);
       fragp = frag_more (7 * 4);
-      md_number_to_chars (fragp, (valueT) s3_cur_proc_ptr->reg_mask, 4);
-      md_number_to_chars (fragp + 4, (valueT) s3_cur_proc_ptr->reg_offset, 4);
-      md_number_to_chars (fragp + 8, (valueT) s3_cur_proc_ptr->fpreg_mask, 4);
-      md_number_to_chars (fragp + 12, (valueT) s3_cur_proc_ptr->leaf, 4);
-      md_number_to_chars (fragp + 16, (valueT) s3_cur_proc_ptr->frame_offset, 4);
-      md_number_to_chars (fragp + 20, (valueT) s3_cur_proc_ptr->frame_reg, 4);
-      md_number_to_chars (fragp + 24, (valueT) s3_cur_proc_ptr->pc_reg, 4);
+      md_number_to_chars (fragp, s3_cur_proc_ptr->reg_mask, 4);
+      md_number_to_chars (fragp + 4, s3_cur_proc_ptr->reg_offset, 4);
+      md_number_to_chars (fragp + 8, s3_cur_proc_ptr->fpreg_mask, 4);
+      md_number_to_chars (fragp + 12, s3_cur_proc_ptr->leaf, 4);
+      md_number_to_chars (fragp + 16, s3_cur_proc_ptr->frame_offset, 4);
+      md_number_to_chars (fragp + 20, s3_cur_proc_ptr->frame_reg, 4);
+      md_number_to_chars (fragp + 24, s3_cur_proc_ptr->pc_reg, 4);
       subseg_set (saved_seg, saved_subseg);
 
     }
@@ -6613,19 +6613,19 @@ s3_atof (int type, char *litP, int *sizeP)
   if (target_big_endian)
     {
       for (i = 0; i < prec; i++)
-        {
-          s3_md_number_to_chars (litP, (valueT) words[i], 2);
-          litP += 2;
-        }
+	{
+	  s3_md_number_to_chars (litP, words[i], 2);
+	  litP += 2;
+	}
     }
   else
     {
       for (i = 0; i < prec; i += 2)
-        {
-          s3_md_number_to_chars (litP, (valueT) words[i + 1], 2);
-          s3_md_number_to_chars (litP + 2, (valueT) words[i], 2);
-          litP += 4;
-        }
+	{
+	  s3_md_number_to_chars (litP, words[i + 1], 2);
+	  s3_md_number_to_chars (litP + 2, words[i], 2);
+	  litP += 4;
+	}
     }
 
   return 0;
diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c
index 6bbdd0fdf3f..d0b5c1bccc7 100644
--- a/gas/config/tc-score7.c
+++ b/gas/config/tc-score7.c
@@ -5655,13 +5655,13 @@ s7_s_score_end (int x ATTRIBUTE_UNUSED)
       exp.X_add_number = 0;
       emit_expr (&exp, 4);
       fragp = frag_more (7 * 4);
-      s7_number_to_chars (fragp, (valueT) s7_cur_proc_ptr->reg_mask, 4);
-      s7_number_to_chars (fragp + 4, (valueT) s7_cur_proc_ptr->reg_offset, 4);
-      s7_number_to_chars (fragp + 8, (valueT) s7_cur_proc_ptr->fpreg_mask, 4);
-      s7_number_to_chars (fragp + 12, (valueT) s7_cur_proc_ptr->leaf, 4);
-      s7_number_to_chars (fragp + 16, (valueT) s7_cur_proc_ptr->frame_offset, 4);
-      s7_number_to_chars (fragp + 20, (valueT) s7_cur_proc_ptr->frame_reg, 4);
-      s7_number_to_chars (fragp + 24, (valueT) s7_cur_proc_ptr->pc_reg, 4);
+      s7_number_to_chars (fragp, s7_cur_proc_ptr->reg_mask, 4);
+      s7_number_to_chars (fragp + 4, s7_cur_proc_ptr->reg_offset, 4);
+      s7_number_to_chars (fragp + 8, s7_cur_proc_ptr->fpreg_mask, 4);
+      s7_number_to_chars (fragp + 12, s7_cur_proc_ptr->leaf, 4);
+      s7_number_to_chars (fragp + 16, s7_cur_proc_ptr->frame_offset, 4);
+      s7_number_to_chars (fragp + 20, s7_cur_proc_ptr->frame_reg, 4);
+      s7_number_to_chars (fragp + 24, s7_cur_proc_ptr->pc_reg, 4);
       subseg_set (saved_seg, saved_subseg);
 
     }
@@ -5844,7 +5844,7 @@ s7_s_score_gpword (int ignore ATTRIBUTE_UNUSED)
       ignore_rest_of_line ();
     }
   p = frag_more (4);
-  s7_number_to_chars (p, (valueT) 0, 4);
+  s7_number_to_chars (p, 0, 4);
   fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, false, BFD_RELOC_GPREL32);
   demand_empty_rest_of_line ();
 }
@@ -6184,19 +6184,19 @@ s7_atof (int type, char *litP, int *sizeP)
   if (target_big_endian)
     {
       for (i = 0; i < prec; i++)
-        {
-          s7_number_to_chars (litP, (valueT) words[i], 2);
-          litP += 2;
-        }
+	{
+	  s7_number_to_chars (litP, words[i], 2);
+	  litP += 2;
+	}
     }
   else
     {
       for (i = 0; i < prec; i += 2)
-        {
-          s7_number_to_chars (litP, (valueT) words[i + 1], 2);
-          s7_number_to_chars (litP + 2, (valueT) words[i], 2);
-          litP += 4;
-        }
+	{
+	  s7_number_to_chars (litP, words[i + 1], 2);
+	  s7_number_to_chars (litP + 2, words[i], 2);
+	  litP += 4;
+	}
     }
 
   return 0;
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 321a21299e9..ec17a2f75fd 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -3402,9 +3402,9 @@ output_insn (const struct sparc_opcode *insn, struct sparc_it *theinsn)
 
   /* Put out the opcode.  */
   if (INSN_BIG_ENDIAN)
-    number_to_chars_bigendian (toP, (valueT) theinsn->opcode, 4);
+    number_to_chars_bigendian (toP, theinsn->opcode, 4);
   else
-    number_to_chars_littleendian (toP, (valueT) theinsn->opcode, 4);
+    number_to_chars_littleendian (toP, theinsn->opcode, 4);
 
   /* Put out the symbol-dependent stuff.  */
   if (theinsn->reloc != BFD_RELOC_NONE)
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 7f00418f479..323f8bb23db 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1061,7 +1061,7 @@ tic30_parallel_insn (char *token)
     char *p;
 
     p = frag_more (INSN_SIZE);
-    md_number_to_chars (p, (valueT) p_insn.opcode, INSN_SIZE);
+    md_number_to_chars (p, p_insn.opcode, INSN_SIZE);
   }
 
   {
@@ -1672,7 +1672,7 @@ md_assemble (char *line)
 
       insn.opcode |= insn.addressing_mode;
       p = frag_more (INSN_SIZE);
-      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+      md_number_to_chars (p, insn.opcode, INSN_SIZE);
     }
   else
     {
@@ -1723,12 +1723,12 @@ md_assemble (char *line)
 		     into instruction word, and output.  */
 		  insn.opcode |=
 		    (insn.operand_type[am_insn]->direct.address & 0x0000FFFF);
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		}
 	      else
 		{
 		  /* Unresolved direct addressing mode instruction.  */
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		  fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2,
 			       & insn.operand_type[am_insn]->direct.direct_expr,
 			       0, 0);
@@ -1748,7 +1748,7 @@ md_assemble (char *line)
 		    {
 		    case Imm_Float:
 		      debug ("Floating point first operand\n");
-		      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 
 		      keeploc = input_line_pointer;
 		      input_line_pointer =
@@ -1771,7 +1771,7 @@ md_assemble (char *line)
 			as_warn (_("only lower 16-bits of first operand are used"));
 		      insn.opcode |=
 			(insn.operand_type[0]->immediate.u_number & 0x0000FFFFL);
-		      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		      break;
 
 		    case Imm_SInt:
@@ -1788,7 +1788,7 @@ md_assemble (char *line)
 			}
 		      insn.opcode |=
 			(insn.operand_type[0]->immediate.s_number & 0x0000FFFFL);
-		      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		      break;
 		    }
 		}
@@ -1797,7 +1797,7 @@ md_assemble (char *line)
 		  /* Unresolved immediate label.  */
 		  if (insn.operands > 1)
 		    insn.opcode |= (insn.operand_type[1]->reg.opcode << 16);
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		  fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2,
 			       & insn.operand_type[0]->immediate.imm_expr,
 			       0, 0);
@@ -1814,7 +1814,7 @@ md_assemble (char *line)
 		{
 		  insn.opcode |= (insn.operand_type[0]->reg.opcode);
 		  insn.opcode |= PC_Register;
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		}
 	      else
 		{
@@ -1823,11 +1823,11 @@ md_assemble (char *line)
 		    {
 		      insn.opcode |=
 			(insn.operand_type[0]->immediate.s_number & 0x0000FFFF);
-		      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		    }
 		  else
 		    {
-		      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		      fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal),
 				   2, & insn.operand_type[0]->immediate.imm_expr,
 				   1, 0);
@@ -1842,7 +1842,7 @@ md_assemble (char *line)
 		{
 		  insn.opcode |= (insn.operand_type[1]->reg.opcode);
 		  insn.opcode |= PC_Register;
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		}
 	      else if (insn.operand_type[1]->immediate.resolved == 1)
 		{
@@ -1859,12 +1859,12 @@ md_assemble (char *line)
 		    }
 		  insn.opcode |= (insn.operand_type[1]->immediate.s_number);
 		  insn.opcode |= PC_Relative;
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		}
 	      else
 		{
 		  insn.opcode |= PC_Relative;
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		  fix_new_exp (frag_now, p + 2 - frag_now->fr_literal, 2,
 			       & insn.operand_type[1]->immediate.imm_expr,
 			       1, 0);
@@ -1882,14 +1882,14 @@ md_assemble (char *line)
 	      as_bad (_("interrupt vector for trap instruction out of range"));
 	      return;
 	    }
-	  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+	  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 	}
       else if (insn.tm->opcode_modifier == StackOp
 	       || insn.tm->opcode_modifier == Rotate)
 	{
 	  /* Push, Pop and Rotate instructions.  */
 	  insn.opcode |= (insn.operand_type[0]->reg.opcode << 16);
-	  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+	  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 	}
       else if ((insn.tm->operand_types[0] & (Abs24 | Direct))
 	       == (Abs24 | Direct))
@@ -1903,13 +1903,13 @@ md_assemble (char *line)
 		  /* Direct addressing uses lower 8 bits of direct address.  */
 		  insn.opcode |=
 		    (insn.operand_type[0]->direct.address & 0x00FF0000) >> 16;
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		}
 	      else
 		{
 		  fixS *fix;
 
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		  fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal),
 				     1, &insn.operand_type[0]->direct.direct_expr, 0, 0);
 		  /* Ensure that the assembler doesn't complain
@@ -1929,12 +1929,12 @@ md_assemble (char *line)
 		    }
 		  insn.opcode |=
 		    ((insn.operand_type[0]->immediate.u_number & 0x00FF0000) >> 16);
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		}
 	      else
 		{
 		  fixS *fix;
-		  md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+		  md_number_to_chars (p, insn.opcode, INSN_SIZE);
 		  fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal),
 				     1, &insn.operand_type[0]->immediate.imm_expr,
 				     0, 0);
@@ -1951,22 +1951,22 @@ md_assemble (char *line)
 		as_warn (_("first operand is too large for a 24-bit displacement"));
 	      insn.opcode |=
 		(insn.operand_type[0]->immediate.u_number & 0x00FFFFFF);
-	      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+	      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 	    }
 	  else
 	    {
-	      md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+	      md_number_to_chars (p, insn.opcode, INSN_SIZE);
 	      fix_new_exp (frag_now, p + 1 - (frag_now->fr_literal), 3,
 			   & insn.operand_type[0]->immediate.imm_expr, 0, 0);
 	    }
 	}
       else if (insn.tm->operand_types[0] & NotReq)
 	/* Check for NOP instruction without arguments.  */
-	md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+	md_number_to_chars (p, insn.opcode, INSN_SIZE);
 
       else if (insn.tm->operands == 0)
 	/* Check for instructions without operands.  */
-	md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE);
+	md_number_to_chars (p, insn.opcode, INSN_SIZE);
     }
   debug ("Addressing mode: %08X\n", insn.addressing_mode);
   {
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 0ee5f6d8b59..22a4eb8007c 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -2581,15 +2581,13 @@ md_atof (int type, char *litP, int *sizeP)
   for (wordP = words; wordP<(words+prec) ; wordP+=2)
     {
       if (wordP < (words + prec - 1)) /* Dump wordP[1] (if we have one).  */
-        {
-          md_number_to_chars (litP, (valueT) (wordP[1]),
-                              sizeof (LITTLENUM_TYPE));
-          litP += sizeof (LITTLENUM_TYPE);
-        }
+	{
+	  md_number_to_chars (litP, wordP[1], sizeof (LITTLENUM_TYPE));
+	  litP += sizeof (LITTLENUM_TYPE);
+	}
 
       /* Dump wordP[0] */
-      md_number_to_chars (litP, (valueT) (wordP[0]),
-                          sizeof (LITTLENUM_TYPE));
+      md_number_to_chars (litP, wordP[0], sizeof (LITTLENUM_TYPE));
       litP += sizeof (LITTLENUM_TYPE);
     }
   return NULL;
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index b1d5bc1ed43..25efad6a461 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -4001,7 +4001,7 @@ emit_insn (tic54x_insn *insn)
       char *p = frag_more (size);
 
       if (size == 2)
-	md_number_to_chars (p, (valueT) insn->opcode[i].word, 2);
+	md_number_to_chars (p, insn->opcode[i].word, 2);
       else
 	md_number_to_chars (p, (valueT) insn->opcode[i].word << 16, 4);
 
diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c
index fae4b0a20c4..1392618c599 100644
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -1351,7 +1351,7 @@ md_atof (int type, char *litP, int *sizeP)
      the bigendian 386.  */
   for (wordP = words + prec - 1; prec--;)
     {
-      md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
+      md_number_to_chars (litP, *wordP--, sizeof (LITTLENUM_TYPE));
       litP += sizeof (LITTLENUM_TYPE);
     }
   return 0;
diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c
index 738b24a1b92..4481731daac 100644
--- a/gas/config/tc-tilepro.c
+++ b/gas/config/tc-tilepro.c
@@ -878,8 +878,8 @@ tilepro_flush_bundle (void)
 					f);
     }
 
-  number_to_chars_littleendian (f, (unsigned int)bits, 4);
-  number_to_chars_littleendian (f + 4, (unsigned int)(bits >> 32), 4);
+  number_to_chars_littleendian (f, bits, 4);
+  number_to_chars_littleendian (f + 4, bits >> 32, 4);
   current_bundle_index = 0;
 
   /* Emit DWARF2 debugging information.  */
@@ -1227,7 +1227,7 @@ md_atof (int type, char *litP, int *sizeP)
      the bigendian 386.  */
   for (wordP = words + prec - 1; prec--;)
     {
-      md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
+      md_number_to_chars (litP, *wordP--, sizeof (LITTLENUM_TYPE));
       litP += sizeof (LITTLENUM_TYPE);
     }
   return 0;
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index f160ec283c2..d7f609f9fcd 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -3745,7 +3745,7 @@ v850_md_finish (void)
 
       /* Write the note type.  */
       p = frag_more (4);
-      md_number_to_chars (p, (valueT) id, 4);
+      md_number_to_chars (p, id, 4);
 
       /* Write the name field.  */
       p = frag_more (4);
diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c
index 63c1ad8db16..c1a6d75f4fe 100644
--- a/gas/config/tc-visium.c
+++ b/gas/config/tc-visium.c
@@ -831,8 +831,7 @@ md_atof (int type, char *litP, int *sizeP)
     {
       for (i = 0; i < prec; i++)
 	{
-	  md_number_to_chars (litP, (valueT) words[i],
-			      sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
@@ -840,8 +839,7 @@ md_atof (int type, char *litP, int *sizeP)
     {
       for (i = prec - 1; i >= 0; i--)
 	{
-	  md_number_to_chars (litP, (valueT) words[i],
-			      sizeof (LITTLENUM_TYPE));
+	  md_number_to_chars (litP, words[i], sizeof (LITTLENUM_TYPE));
 	  litP += sizeof (LITTLENUM_TYPE);
 	}
     }
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 9afda6beba2..4b67f76289d 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -9001,15 +9001,15 @@ xtensa_add_config_info (void)
   /* Follow the standard note section layout:
      First write the length of the name string.  */
   p = frag_more (4);
-  md_number_to_chars (p, (valueT) XTINFO_NAMESZ, 4);
+  md_number_to_chars (p, XTINFO_NAMESZ, 4);
 
   /* Next comes the length of the "descriptor", i.e., the actual data.  */
   p = frag_more (4);
-  md_number_to_chars (p, (valueT) sz, 4);
+  md_number_to_chars (p, sz, 4);
 
   /* Write the note type.  */
   p = frag_more (4);
-  md_number_to_chars (p, (valueT) XTINFO_TYPE, 4);
+  md_number_to_chars (p, XTINFO_TYPE, 4);
 
   /* Write the name field.  */
   p = frag_more (XTINFO_NAMESZ);
diff --git a/gas/read.c b/gas/read.c
index a00fa974a22..5a3d6ae662d 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2434,7 +2434,7 @@ s_fill (int ignore ATTRIBUTE_UNUSED)
       md_number_to_chars (p, fill,
 			  (size > BSD_FILL_SIZE_CROCK_4
 			   ? BSD_FILL_SIZE_CROCK_4
-			   : (int) size));
+			   : size));
       /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
 	 but emits no error message because it seems a legal thing to do.
 	 It is a degenerate case of .fill but could be emitted by a
@@ -4749,7 +4749,7 @@ emit_expr_with_reloc (expressionS *exp,
 		   (uint64_t) get, (uint64_t) use);
 	}
       /* Put bytes in right order.  */
-      md_number_to_chars (p, use, (int) nbytes);
+      md_number_to_chars (p, use, nbytes);
     }
   else if (op == O_big)
     {
@@ -4798,7 +4798,7 @@ emit_expr_with_reloc (expressionS *exp,
 
       if (nbytes == 1)
 	{
-	  md_number_to_chars (p, (valueT) generic_bignum[0], 1);
+	  md_number_to_chars (p, generic_bignum[0], 1);
 	  return;
 	}
       know (nbytes % CHARS_PER_LITTLENUM == 0);
@@ -4816,7 +4816,7 @@ emit_expr_with_reloc (expressionS *exp,
 	  while (size >= CHARS_PER_LITTLENUM)
 	    {
 	      --nums;
-	      md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
+	      md_number_to_chars (p, *nums, CHARS_PER_LITTLENUM);
 	      size -= CHARS_PER_LITTLENUM;
 	      p += CHARS_PER_LITTLENUM;
 	    }
@@ -4826,7 +4826,7 @@ emit_expr_with_reloc (expressionS *exp,
 	  nums = generic_bignum;
 	  while (size >= CHARS_PER_LITTLENUM)
 	    {
-	      md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
+	      md_number_to_chars (p, *nums, CHARS_PER_LITTLENUM);
 	      ++nums;
 	      size -= CHARS_PER_LITTLENUM;
 	      p += CHARS_PER_LITTLENUM;
diff --git a/gas/stabs.c b/gas/stabs.c
index 5f7b7fbfef0..da5228f680c 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -358,10 +358,10 @@ s_stab_generic (int what,
       /* At least for now, stabs in a special stab section are always
 	 output as 12 byte blocks of information.  */
       p = frag_more (8);
-      md_number_to_chars (p, (valueT) stroff, 4);
-      md_number_to_chars (p + 4, (valueT) type, 1);
-      md_number_to_chars (p + 5, (valueT) other, 1);
-      md_number_to_chars (p + 6, (valueT) desc, 2);
+      md_number_to_chars (p, stroff, 4);
+      md_number_to_chars (p + 4, type, 1);
+      md_number_to_chars (p + 5, other, 1);
+      md_number_to_chars (p + 6, desc, 2);
 
       if (what == 's' || what == 'n')
 	{

-- 
Alan Modra


More information about the Binutils mailing list