From: Richard Earnshaw Date: Thu, 20 Nov 2014 17:02:47 +0000 (+0000) Subject: * config/tc-arm.c (rotate_left): Avoid undefined behaviour when N = 0. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d840c081f8082e8b9e63fead5306643975a97bb3;p=binutils-gdb.git * config/tc-arm.c (rotate_left): Avoid undefined behaviour when N = 0. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 97e5a9ef9b6..a9481f5ee9a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Richard Earnshaw + + * config/tc-arm.c (rotate_left): Avoid undefined behaviour when + N = 0. + 2014-11-20 Richard Earnshaw * config/tc-aarch64.c (warn_unpredictable_ldst): Check that transfer diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 5077f87ea4f..9100fb252ad 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -7251,7 +7251,7 @@ parse_operands (char *str, const unsigned int *pattern, bfd_boolean thumb) /* Functions for operand encoding. ARM, then Thumb. */ -#define rotate_left(v, n) (v << n | v >> (32 - n)) +#define rotate_left(v, n) (v << (n & 31) | v >> ((32 - n) & 31)) /* If VAL can be encoded in the immediate field of an ARM instruction, return the encoded form. Otherwise, return FAIL. */