From da3ef51629fc524b532ee6a16c72d61207413dc9 Mon Sep 17 00:00:00 2001 From: naddy Date: Sun, 4 Jun 2017 20:26:18 +0000 Subject: [PATCH] Replace ((2 << 31) - 1) with 0xffffffff, which is equivalent but doesn't cause a shift overflow on a 32-bit arch (i386). ok kettenis@ --- gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c b/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c index 1bfd4670813..5447323e1ce 100644 --- a/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c +++ b/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c @@ -2104,7 +2104,7 @@ optimize_imm () (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000); } if ((i.types[op] & Imm32) - && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1)) + && ((i.op[op].imms->X_add_number & ~(offsetT) 0xffffffffL) == 0)) { i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number @@ -2183,12 +2183,12 @@ optimize_disp () i.types[op] &= ~Disp64; } if ((i.types[op] & Disp32) - && (disp & ~(((offsetT) 2 << 31) - 1)) == 0) + && (disp & ~(offsetT) 0xffffffffL) == 0) { /* If this operand is at most 32 bits, convert to a signed 32 bit number and don't use 64bit displacement. */ - disp &= (((offsetT) 2 << 31) - 1); + disp &= (offsetT) 0xffffffffL; disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); i.types[op] &= ~Disp64; } -- 2.20.1