* config/tc-mips.c (macro_build_ldst_constoffset): Don't silently
authorThiemo Seufer <ths@networkno.de>
Thu, 18 Sep 2003 05:20:04 +0000 (05:20 +0000)
committerThiemo Seufer <ths@networkno.de>
Thu, 18 Sep 2003 05:20:04 +0000 (05:20 +0000)
truncate values which won't fit im 32 bits.
(load_register): Likewise.
(macro): Likewise.

gas/ChangeLog
gas/config/tc-mips.c

index bbd7ecd197cde7062cd75a13df6757a4ff278c04..53942b7c3f6427dcb986e64d12bc568c6bd19411 100644 (file)
@@ -1,3 +1,10 @@
+2003-09-18  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+       * config/tc-mips.c (macro_build_ldst_constoffset): Don't silently
+       truncate values which won't fit im 32 bits.
+       (load_register): Likewise.
+       (macro): Likewise.
+
 2003-09-17  Dmitry Diky <diwil@mail.ru>
 
        * config/tc-msp430.c (MAX_OP_LEN): Set to 256.
index 8c7c69e7c382c866a5288231883e469c0ac4fb62..e63888354cadeb5e8cfde27a3e9e3c05b15b7b56 100644 (file)
@@ -3229,8 +3229,14 @@ macro_build_ldst_constoffset (char *place, int *counter, expressionS *ep,
 
   /* Sign-extending 32-bit constants makes their handling easier.  */
   if (! dbl)
+    {
+      if (ep->X_add_number & ~((bfd_vma) 0xffffffff)
+         && ~(ep->X_add_number | 0xffffffff))
+       as_bad (_("too large constant specified"));
+
     ep->X_add_number = (((ep->X_add_number & 0xffffffff) ^ 0x80000000)
                        - 0x80000000);
+    }
 
   /* Right now, this routine can only handle signed 32-bit contants.  */
   if (! IS_SEXT_32BIT_NUM(ep->X_add_number))
@@ -3387,8 +3393,14 @@ load_register (int *counter, int reg, expressionS *ep, int dbl)
 
       /* Sign-extending 32-bit constants makes their handling easier.  */
       if (! dbl)
+       {
+         if (ep->X_add_number & ~((bfd_vma) 0xffffffff)
+             && ~(ep->X_add_number | 0xffffffff))
+           as_bad (_("too large constant specified"));
+
        ep->X_add_number = (((ep->X_add_number & 0xffffffff) ^ 0x80000000)
                            - 0x80000000);
+       }
 
       if (IS_SEXT_16BIT_NUM (ep->X_add_number))
        {
@@ -5793,8 +5805,14 @@ macro (struct mips_cl_insn *ip)
       if ((! HAVE_64BIT_ADDRESSES
           && (! HAVE_64BIT_GPRS && offset_expr.X_op == O_constant))
           && (offset_expr.X_op == O_constant))
+       {
+         if (offset_expr.X_add_number & ~((bfd_vma) 0xffffffff)
+             && ~(offset_expr.X_add_number | 0xffffffff))
+           as_bad (_("too large constant specified"));
+
        offset_expr.X_add_number = (((offset_expr.X_add_number & 0xffffffff)
                                     ^ 0x80000000) - 0x80000000);
+       }
 
       /* For embedded PIC, we allow loads where the offset is calculated
          by subtracting a symbol in the current segment from an unknown