From 09bcd67d4cdf3a1c944c334a15ae2c6b32b9a775 Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 12 Dec 2017 10:06:45 +0000 Subject: [PATCH] Avoid undefined behaviour in rorate_left() macro. From NetBSD via FreeBSD. Makes gas work when compiled with clang. ok patrick@, millert@ --- gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. */ -- 2.20.1