From: kettenis Date: Tue, 12 Dec 2017 10:06:45 +0000 (+0000) Subject: Avoid undefined behaviour in rorate_left() macro. From NetBSD via FreeBSD. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=09bcd67d4cdf3a1c944c334a15ae2c6b32b9a775;p=openbsd Avoid undefined behaviour in rorate_left() macro. From NetBSD via FreeBSD. Makes gas work when compiled with clang. ok patrick@, millert@ --- diff --git a/gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c b/gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c index da965a0dff8..e00afa2816d 100644 --- a/gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c +++ b/gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c @@ -4266,7 +4266,7 @@ parse_operands (char *str, const unsigned char *pattern) /* Functions for operand encoding. ARM, then Thumb. */ -#define rotate_left(v, n) (v << n | v >> (32 - n)) +#define rotate_left(v, n) (v << (n % 32) | v >> ((32 - n) % 32)) /* If VAL can be encoded in the immediate field of an ARM instruction, return the encoded form. Otherwise, return FAIL. */