public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Fix compile time warnings in tc-mips.c
@ 2005-04-20 14:35 Nick Clifton
  2005-04-20 16:26 ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2005-04-20 14:35 UTC (permalink / raw)
  To: binutils

Hi Guys,

  The recent patch improve larger than 32-bit number handling in the
  GAS MIPS port produced a few compile time warning messages:

    .../gas/config/tc-mips.c: In function `load_register':
    .../gas/config/tc-mips.c:3559: warning: right shift count >= width of type
    .../gas/config/tc-mips.c: In function `macro':
    .../gas/config/tc-mips.c:5804: warning: right shift count >= width of type
    .../gas/config/tc-mips.c:6395: warning: right shift count >= width of type

  I am applying the patch below to fix this problem, by switching over
  to use the sprintf_vma macro to convert the values into readable
  text.

Cheers
  Nick

gas/ChangeLog
2005-04-20  Nick Clifton  <nickc@redhat.com>

	* config/tc-mips.c (macro): Use sprintf_vma to convert a > 32 bit
	number into a readable string.
	(load_register): Likewise.

Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.310
diff -c -3 -p -r1.310 tc-mips.c
*** gas/config/tc-mips.c	18 Apr 2005 14:16:10 -0000	1.310
--- gas/config/tc-mips.c	20 Apr 2005 14:34:13 -0000
*************** load_register (int reg, expressionS *ep,
*** 3555,3563 ****
  
    if (!dbl || HAVE_32BIT_GPRS)
      {
!       as_bad (_("Number (0x%lx%08lx) larger than 32 bits"),
! 	      (unsigned long) (ep->X_add_number >> 32),
! 	      (unsigned long) (ep->X_add_number & 0xffffffff));
        macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16);
        return;
      }
--- 3555,3564 ----
  
    if (!dbl || HAVE_32BIT_GPRS)
      {
!       char value[32];
! 
!       sprintf_vma (value, ep->X_add_number);
!       as_bad (_("Number (%s) larger than 32 bits"), value);
        macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16);
        return;
      }
*************** macro (struct mips_cl_insn *ip)
*** 5800,5808 ****
  
        if (HAVE_32BIT_ADDRESSES
  	  && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! 	as_bad (_("Number (0x%lx%08lx) larger than 32 bits"),
! 		(unsigned long) (offset_expr.X_add_number >> 32),
! 		(unsigned long) (offset_expr.X_add_number & 0xffffffff));
  
        /* A constant expression in PIC code can be handled just as it
  	 is in non PIC code.  */
--- 5801,5812 ----
  
        if (HAVE_32BIT_ADDRESSES
  	  && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! 	{
! 	  char value [32];
! 
! 	  sprintf_vma (value, offset_expr.X_add_number);
! 	  as_bad (_("Number (%s) larger than 32 bits"), value);
! 	}
  
        /* A constant expression in PIC code can be handled just as it
  	 is in non PIC code.  */
*************** macro (struct mips_cl_insn *ip)
*** 6391,6399 ****
  
        if (HAVE_32BIT_ADDRESSES
  	  && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! 	as_bad (_("Number (0x%lx%08lx) larger than 32 bits"),
! 		(unsigned long) (offset_expr.X_add_number >> 32),
! 		(unsigned long) (offset_expr.X_add_number & 0xffffffff));
  
        /* Even on a big endian machine $fn comes before $fn+1.  We have
  	 to adjust when loading from memory.  We set coproc if we must
--- 6395,6406 ----
  
        if (HAVE_32BIT_ADDRESSES
  	  && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
! 	{
! 	  char value [32];
! 
! 	  sprintf_vma (value, offset_expr.X_add_number);
! 	  as_bad (_("Number (%s) larger than 32 bits"), value);
! 	}
  
        /* Even on a big endian machine $fn comes before $fn+1.  We have
  	 to adjust when loading from memory.  We set coproc if we must

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

end of thread, other threads:[~2005-04-20 18:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20 14:35 Fix compile time warnings in tc-mips.c Nick Clifton
2005-04-20 16:26 ` Maciej W. Rozycki
2005-04-20 17:28   ` Nick Clifton
2005-04-20 18:00     ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).