diff options
48 files changed, 118 insertions, 65 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 09b81c3..2214ed3 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,51 @@ +2015-11-09 Dominik Vogt <vogt@linux.vnet.ibm.com> + + * read.c (parse_bitfield_cons): Fix left shift of negative value. + * config/tc-xstormy16.c (md_section_align): Likewise. + * config/tc-xgate.c (md_section_align): Likewise. + * config/tc-visium.c (md_section_align): Likewise. + * config/tc-v850.c (md_section_align): Likewise. + * config/tc-tic6x.c (md_section_align): Likewise. + * config/tc-sh.c (SH64PCREL32_M, SH64PCREL48_M, SH64PCREL32_M) + (MOVI_32_M, MOVI_48_M, MOVI_32_M, md_section_align): Likewise. + * config/tc-sh64.c (shmedia_md_estimate_size_before_relax): Likewise. + * config/tc-score.c (s3_section_align): Likewise. + * config/tc-score7.c (s7_section_align): Likewise. + * config/tc-s390.c (md_section_align): Likewise. + * config/tc-rx.c (md_section_align): Likewise. + * config/tc-rl78.c (md_section_align): Likewise. + * config/tc-ppc.c (md_section_align): Likewise. + * config/tc-or1k.c (md_section_align): Likewise. + * config/tc-nds32.c (md_section_align): Likewise. + * config/tc-mt.c (md_section_align): Likewise. + * config/tc-msp430.c (md_section_align): Likewise. + * config/tc-mn10300.c (md_section_align): Likewise. + * config/tc-mn10200.c (md_section_align): Likewise. + * config/tc-mips.c (md_section_align): Likewise. + * config/tc-microblaze.c (parse_imm): Likewise. + * config/tc-mep.c (md_section_align): Likewise. + * config/tc-m68k.c (md_section_align): Likewise. + * config/tc-m68hc11.c (md_section_align): Likewise. + * config/tc-m32r.c (md_section_align): Likewise. + * config/tc-m32c.c (md_section_align): Likewise. + * config/tc-lm32.c (md_section_align): Likewise. + * config/tc-iq2000.c (md_section_align): Likewise. + * config/tc-ip2k.c (md_section_align): Likewise. + * config/tc-ia64.c (dot_save, dot_vframe): Likewise. + * config/tc-i960.c (md_number_to_field, md_section_align): Likewise. + * config/tc-i386.c (md_section_align): Likewise. + * config/tc-i370.c (md_section_align): Likewise. + * config/tc-frv.c (md_section_align): Likewise. + * config/tc-fr30.c (md_section_align): Likewise. + * config/tc-epiphany.c (md_section_align): Likewise. + * config/tc-d30v.c (md_section_align): Likewise. + * config/tc-d10v.c (md_section_align): Likewise. + * config/tc-cr16.c (l_cons): Likewise. + * config/tc-bfin.c (md_section_align): Likewise. + * config/tc-arm.c (md_section_align): Likewise. + * config/tc-arc.c (md_section_align): Likewise. + * config/bfin-parse.y (expr_1): Likewise. + 2015-11-02 Nick Clifton <nickc@redhat.com> * config/rx-parse.y: Allow zero value for 5-bit displacements. diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y index c2a1d53..75d1b1e 100644 --- a/gas/config/bfin-parse.y +++ b/gas/config/bfin-parse.y @@ -4505,7 +4505,7 @@ static int value_match (Expr_Node *exp, int sz, int sign, int mul, int issigned) { int umax = (1 << sz) - 1; - int min = -1 << (sz - 1); + int min = -(1 << (sz - 1)); int max = (1 << (sz - 1)) - 1; int v = (EXPR_VALUE (exp)) & 0xffffffff; diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index e0a4b57..ca43566 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -1067,7 +1067,7 @@ md_section_align (segT segment, { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } /* The location from which a PC relative jump should be calculated, diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 025e0be..de99d72 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -21019,7 +21019,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, int align; align = bfd_get_section_alignment (stdoutput, segment); - size = ((size + (1 << align) - 1) & ((valueT) -1 << align)); + size = ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } #endif diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 656e515..77b6013 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -796,7 +796,7 @@ md_section_align (segment, size) valueT size; { int boundary = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << boundary) - 1) & (-1 << boundary)); + return ((size + (1 << boundary) - 1) & -(1 << boundary)); } diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index 0f2456e..b524bb7 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -206,7 +206,7 @@ l_cons (int nbytes) return; } - value |= ((~(-1 << width) & exp.X_add_number) + value |= ((~(-(1 << width)) & exp.X_add_number) << ((BITS_PER_CHAR * nbytes) - bits_available)); if ((bits_available -= width) == 0 diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index 8b4b4e1..664fdb6 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -269,7 +269,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index e6174a9..31875d5 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -303,7 +303,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index 276691a..fe1a12f 100644 --- a/gas/config/tc-epiphany.c +++ b/gas/config/tc-epiphany.c @@ -173,7 +173,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index c6e80e3..a151c35 100644 --- a/gas/config/tc-fr30.c +++ b/gas/config/tc-fr30.c @@ -156,7 +156,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index 0ca1a6e..a7a1665 100644 --- a/gas/config/tc-frv.c +++ b/gas/config/tc-frv.c @@ -1227,7 +1227,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c index ba82b2c..321cae8 100644 --- a/gas/config/tc-i370.c +++ b/gas/config/tc-i370.c @@ -2375,7 +2375,7 @@ md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return (addr + (1 << align) - 1) & (-1 << align); + return (addr + (1 << align) - 1) & -(1 << align); } /* We don't have any form of relaxing. */ diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index d74e870..d341193 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -10317,7 +10317,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) int align; align = bfd_get_section_alignment (stdoutput, segment); - size = ((size + (1 << align) - 1) & ((valueT) -1 << align)); + size = ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } #endif diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c index e27d816..35ec138 100644 --- a/gas/config/tc-i960.c +++ b/gas/config/tc-i960.c @@ -1751,7 +1751,7 @@ md_number_to_field (char *instrP, /* Pointer to instruction to be fixed. */ { /* Put bit field into instruction and write back in target * byte order. */ - val &= ~(-1 << (int) numbits); /* Clear unused sign bits. */ + val &= ~(-(1 << (int) numbits)); /* Clear unused sign bits. */ instr |= val; md_number_to_chars (instrP, instr, 4); } @@ -2466,7 +2466,7 @@ md_section_align (segT seg, int align; align = bfd_get_section_alignment (stdoutput, seg); - return (addr + (1 << align) - 1) & (-1 << align); + return (addr + (1 << align) - 1) & -(1 << align); } extern int coff_flags; diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index ea7dcc6..8a34fea 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -3339,7 +3339,7 @@ dot_vframe (int dummy ATTRIBUTE_UNUSED) if (! (unwind.prologue_mask & 2)) add_unwind_entry (output_psp_gr (reg), NOT_A_CHAR); else if (reg != unwind.prologue_gr - + (unsigned) popcount (unwind.prologue_mask & (-2 << 1))) + + (unsigned) popcount (unwind.prologue_mask & -(2 << 1))) as_warn (_("Operand of .vframe contradicts .prologue")); } @@ -3421,7 +3421,7 @@ dot_save (int dummy ATTRIBUTE_UNUSED) if (! (unwind.prologue_mask & 4)) add_unwind_entry (output_pfs_gr (reg2), NOT_A_CHAR); else if (reg2 != unwind.prologue_gr - + (unsigned) popcount (unwind.prologue_mask & (-4 << 1))) + + (unsigned) popcount (unwind.prologue_mask & -(4 << 1))) as_warn (_("Second operand of .save contradicts .prologue")); break; case REG_AR + AR_LC: @@ -3440,7 +3440,7 @@ dot_save (int dummy ATTRIBUTE_UNUSED) if (! (unwind.prologue_mask & 1)) add_unwind_entry (output_preds_gr (reg2), NOT_A_CHAR); else if (reg2 != unwind.prologue_gr - + (unsigned) popcount (unwind.prologue_mask & (-1 << 1))) + + (unsigned) popcount (unwind.prologue_mask & -(1 << 1))) as_warn (_("Second operand of .save contradicts .prologue")); break; case REG_PRIUNAT: diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c index 4f4cffe..d58a85f 100644 --- a/gas/config/tc-ip2k.c +++ b/gas/config/tc-ip2k.c @@ -231,7 +231,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index 2d55da1..381d627 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -432,7 +432,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c index 3b127fd..032175a 100644 --- a/gas/config/tc-lm32.c +++ b/gas/config/tc-lm32.c @@ -278,7 +278,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } /* This function assembles the instructions. It emits the frags/bytes to the diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c index 10eba14..7644cb2 100644 --- a/gas/config/tc-m32c.c +++ b/gas/config/tc-m32c.c @@ -410,7 +410,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index 4a14bf1..ce68f25 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -1450,7 +1450,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 43cf6b6..fdaf901 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -584,7 +584,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } static int diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index b8f051e..d3e22fc 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -7888,7 +7888,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) int align; align = bfd_get_section_alignment (stdoutput, segment); - size = ((size + (1 << align) - 1) & ((valueT) -1 << align)); + size = ((size + (1 << align) - 1) & (-((valueT) 1 << align))); #endif return size; diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index 780356f..88d111a 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -1382,7 +1382,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index b43925b..ac7c828 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -739,7 +739,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) { /* Special case: sign extend negative 32-bit values to 64-bits. */ if ((e->X_add_number >> 31) == 1) - e->X_add_number |= (-1 << 31); + e->X_add_number |= -(1 << 31); if (e->X_add_number < min || e->X_add_number > max) { diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index d951dfc..a2d45a4 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -16500,7 +16500,7 @@ md_section_align (asection *seg, valueT addr) if (align > 4) align = 4; - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } /* Utility routine, called from above as well. If called while the diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index cabbcc1..7e3e835 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -676,7 +676,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index da05cac..8a265aa 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -905,7 +905,7 @@ md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 8e32189..ef7c5ee 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -3955,7 +3955,7 @@ md_section_align (asection * seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } /* If you define this macro, it should return the offset between the diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c index b90ee60..1d51465 100644 --- a/gas/config/tc-mt.c +++ b/gas/config/tc-mt.c @@ -333,7 +333,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index 06e419d..1846256 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -5380,7 +5380,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } /* GAS will call this function when a symbol table lookup fails, before it diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c index dba2dde..18db230 100644 --- a/gas/config/tc-or1k.c +++ b/gas/config/tc-or1k.c @@ -166,7 +166,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index b6b4412..b4c00c4 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -6090,7 +6090,7 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr) #else int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); #endif } diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index a74703e..9fbaa42 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -1469,5 +1469,5 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 8e99fa3..4697e95 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -1248,7 +1248,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } /* NOP - 1 cycle */ diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index e217e56..d597ee6 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -2047,7 +2047,7 @@ md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } /* We don't have any form of relaxing. */ diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 49ed5f2..15b4ed7 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -7089,7 +7089,7 @@ static valueT s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } static void diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index e8af055..2b1eb5d 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -6634,7 +6634,7 @@ s7_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } static void diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 1b5beb2..125f073 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -281,15 +281,15 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; #if BFD_HOST_64BIT_LONG /* The "reach" type is long, so we can only do this for a 64-bit-long host. */ -#define SH64PCREL32_M (((long) -1 << 30) * 2 - 4) +#define SH64PCREL32_M ((-((long) 1 << 30)) * 2 - 4) #define SH64PCREL48_F ((((long) 1 << 47) - 1) - 4) -#define SH64PCREL48_M (((long) -1 << 47) - 4) +#define SH64PCREL48_M ((-((long) 1 << 47)) - 4) #define SH64PCREL48_LENGTH (3 * 4) #else /* If the host does not have 64-bit longs, just make this state identical in reach to the 32-bit state. Note that we have a slightly incorrect reach, but the correct one above will overflow a 32-bit number. */ -#define SH64PCREL32_M (((long) -1 << 30) * 2) +#define SH64PCREL32_M ((-((long) 1 << 30)) * 2) #define SH64PCREL48_F SH64PCREL32_F #define SH64PCREL48_M SH64PCREL32_M #define SH64PCREL48_LENGTH (3 * 4) @@ -313,14 +313,14 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; #if BFD_HOST_64BIT_LONG /* The "reach" type is long, so we can only do this for a 64-bit-long host. */ -#define MOVI_32_M (((long) -1 << 30) * 2 - 4) +#define MOVI_32_M ((-((long) 1 << 30)) * 2 - 4) #define MOVI_48_F ((((long) 1 << 47) - 1) - 4) -#define MOVI_48_M (((long) -1 << 47) - 4) +#define MOVI_48_M ((-((long) 1 << 47)) - 4) #else /* If the host does not have 64-bit longs, just make this state identical in reach to the 32-bit state. Note that we have a slightly incorrect reach, but the correct one above will overflow a 32-bit number. */ -#define MOVI_32_M (((long) -1 << 30) * 2) +#define MOVI_32_M ((-((long) 1 << 30)) * 2) #define MOVI_48_F MOVI_32_F #define MOVI_48_M MOVI_32_M #endif /* BFD_HOST_64BIT_LONG */ @@ -3692,7 +3692,7 @@ md_section_align (segT seg ATTRIBUTE_UNUSED, valueT size) return size; #else /* ! OBJ_ELF */ return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1) - & (-1 << bfd_get_section_alignment (stdoutput, seg))); + & -(1 << bfd_get_section_alignment (stdoutput, seg))); #endif /* ! OBJ_ELF */ } diff --git a/gas/config/tc-sh64.c b/gas/config/tc-sh64.c index 780052b..2c0bcde 100644 --- a/gas/config/tc-sh64.c +++ b/gas/config/tc-sh64.c @@ -2020,7 +2020,7 @@ shmedia_md_estimate_size_before_relax (fragS *fragP, offsetT value = fragP->fr_offset + (fragP->fr_symbol == NULL ? 0 : S_GET_VALUE (fragP->fr_symbol)); - if (value >= ((offsetT) -1 << 15) && value < ((offsetT) 1 << 15)) + if (value >= (-((offsetT) 1 << 15)) && value < ((offsetT) 1 << 15)) { /* Fits in 16-bit signed number. */ int what = GET_WHAT (fragP->fr_subtype); diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 64d39be..1a8ddde 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -4484,7 +4484,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, /* Round up section sizes to ensure that text sections consist of whole fetch packets. */ int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & ((valueT) -1 << align)); + return ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } /* No special undefined symbol handling needed for now. */ diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index f42e767..1091316 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -1879,7 +1879,7 @@ valueT md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c index 3cc434e..2b656fe 100644 --- a/gas/config/tc-visium.c +++ b/gas/config/tc-visium.c @@ -224,7 +224,7 @@ md_section_align (asection *seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c index bcfc845..d5fc3d5 100644 --- a/gas/config/tc-xc16x.c +++ b/gas/config/tc-xc16x.c @@ -235,7 +235,7 @@ valueT md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index 3c00b01..afb2578 100644 --- a/gas/config/tc-xgate.c +++ b/gas/config/tc-xgate.c @@ -469,7 +469,7 @@ valueT md_section_align (asection * seg, valueT addr) { int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); + return ((addr + (1 << align) - 1) & -(1 << align)); } void diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index 981dc95..3f0613c 100644 --- a/gas/config/tc-xstormy16.c +++ b/gas/config/tc-xstormy16.c @@ -279,7 +279,7 @@ md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); - return ((size + (1 << align) - 1) & (-1 << align)); + return ((size + (1 << align) - 1) & -(1 << align)); } symbolS * @@ -4602,7 +4602,7 @@ parse_bitfield_cons (exp, nbytes) return; } /* Too complex. */ - value |= ((~(-1 << width) & exp->X_add_number) + value |= ((~(-(1 << width)) & exp->X_add_number) << ((BITS_PER_CHAR * nbytes) - bits_available)); if ((bits_available -= width) == 0 diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 5e1e88f..b125ba6 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-09 Dominik Vogt <vogt@linux.vnet.ibm.com> + + * gas/all/test-gen.c (random_order_16s, random_order_24s) + (random_order_32s): Fix left shift of negative value. + 2015-11-02 Nick Clifton <nickc@redhat.com> * gas/rx/max.d: Update expected disassembly. diff --git a/gas/testsuite/gas/all/test-gen.c b/gas/testsuite/gas/all/test-gen.c index abd7b9e..97c4d4b 100644 --- a/gas/testsuite/gas/all/test-gen.c +++ b/gas/testsuite/gas/all/test-gen.c @@ -404,12 +404,12 @@ int random_order_16s[] = generated often enough. */ -32768, 32767, - (-1 << 15) | (64 << 8) | 32, + (-(1 << 15)) | (64 << 8) | 32, (64 << 8) | 32, 0x1234, - (-1 << 15) | 0x8765, + (-(1 << 15)) | 0x8765, 0x0180, - (-1 << 15) | 0x8001 + (-(1 << 15)) | 0x8001 }; /* Use `24s' to generate 24-bit signed values. Good for selecting @@ -420,14 +420,14 @@ int random_order_24s[] = intermediate values selected by chance. Keep the number of intermediate values low, to ensure that the limit values are generated often enough. */ - -1 << 23, + -(1 << 23), 1 << 23 -1, - (-1 << 23) | (((64 << 8) | 32) << 8) | 16, + (-(1 << 23)) | (((64 << 8) | 32) << 8) | 16, (((64 << 8) | 32) << 8) | 16, 0x123456, - (-1 << 23) | 0x876543, + (-(1 << 23)) | 0x876543, 0x01ff80, - (-1 << 23) | 0x80ff01 + (-(1 << 23)) | 0x80ff01 }; /* Use `32s' to generate 32-bit signed values. Good for selecting @@ -438,14 +438,14 @@ int random_order_32s[] = intermediate values selected by chance. Keep the number of intermediate values low, to ensure that the limit values are generated often enough. */ - -1 << 31, + -(1 << 31), 1 << 31 - 1, - (-1 << 31) | (((((64 << 8) | 32) << 8) | 16) << 8) | 8, + (-(1 << 31)) | (((((64 << 8) | 32) << 8) | 16) << 8) | 8, (((((64 << 8) | 32) << 8) | 16) << 8) | 8, 0x12345678, - (-1 << 31) | 0x87654321, + (-(1 << 31)) | 0x87654321, 0x01ffff80, - (-1 << 31) | 0x80ffff01 + (-(1 << 31)) | 0x80ffff01 }; /* This function computes the number of digits needed to represent a |