This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mipsisa32-unknown-elf-as: Error: too large constant specified


Nigel Stephens <nigel@mips.com> writes:

> I believe that this new behaviour is broken.

cgd@broadcom.com writes:

> I'd guess this is a recent regression.

Hey, I'm easy.  Any opinions on this patch?  I haven't tried the
testsuite yet.  In any case, clearly some new tests are called for
here.

Ian

Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.234
diff -u -r1.234 tc-mips.c
--- tc-mips.c	1 Oct 2003 18:57:16 -0000	1.234
+++ tc-mips.c	15 Oct 2003 00:14:21 -0000
@@ -820,6 +820,10 @@
   (((x) &~ (offsetT) 0x7fff) == 0					\
    || (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff))
 
+/* Is the given value a 32-bit value?  */
+#define IS_32BIT_NUM(x)							\
+  (((x) &~ (offsetT) 0xffffffff) == 0					\
+   || (((x) &~ (offsetT) 0xffffffff) == ~ (offsetT) 0xffffffff))
 
 /* Prototypes for static functions.  */
 
@@ -3270,11 +3274,11 @@
   if (! dbl && ! ((ep->X_add_number & ~((bfd_vma) 0x7fffffff))
 		  == ~((bfd_vma) 0x7fffffff)))
     {
-      if (ep->X_add_number & ~((bfd_vma) 0xffffffff))
-	as_bad (_("too large constant specified"));
+      if (! IS_32BIT_NUM (ep->X_add_number))
+	as_bad (_("constant too large"));
 
-    ep->X_add_number = (((ep->X_add_number & 0xffffffff) ^ 0x80000000)
-			- 0x80000000);
+      ep->X_add_number = (((ep->X_add_number & 0xffffffff) ^ 0x80000000)
+			  - 0x80000000);
     }
 
   /* Right now, this routine can only handle signed 32-bit contants.  */
@@ -3434,11 +3438,11 @@
       if (! dbl && ! ((ep->X_add_number & ~((bfd_vma) 0x7fffffff))
 		      == ~((bfd_vma) 0x7fffffff)))
 	{
-	  if (ep->X_add_number & ~((bfd_vma) 0xffffffff))
-	    as_bad (_("too large constant specified"));
+	  if (! IS_32BIT_NUM (ep->X_add_number))
+	    as_bad (_("constant too large"));
 
-	ep->X_add_number = (((ep->X_add_number & 0xffffffff) ^ 0x80000000)
-			    - 0x80000000);
+	  ep->X_add_number = (((ep->X_add_number & 0xffffffff) ^ 0x80000000)
+			      - 0x80000000);
 	}
 
       if (IS_SEXT_16BIT_NUM (ep->X_add_number))
@@ -5945,11 +5949,11 @@
 	  && ! ((offset_expr.X_add_number & ~((bfd_vma) 0x7fffffff))
 		== ~((bfd_vma) 0x7fffffff)))
 	{
-	  if (offset_expr.X_add_number & ~((bfd_vma) 0xffffffff))
-	    as_bad (_("too large constant specified"));
+	  if (! IS_32BIT_NUM (offset_expr.X_add_number))
+	    as_bad (_("constant too large"));
 
-	offset_expr.X_add_number = (((offset_expr.X_add_number & 0xffffffff)
-				     ^ 0x80000000) - 0x80000000);
+	  offset_expr.X_add_number = (((offset_expr.X_add_number & 0xffffffff)
+				       ^ 0x80000000) - 0x80000000);
 	}
 
       /* For embedded PIC, we allow loads where the offset is calculated


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]