From dce121d553ad1b2a7795d6fe0caea9a5bee2d00e Mon Sep 17 00:00:00 2001 From: dim Date: Tue, 25 Nov 2014 12:58:21 +0000 Subject: [PATCH] MFC r274856: Avoid undefined behaviour in gas's rotate_left() macro for n == 0. Otherwise, clang can effectively remove the first iteration of the for loops where this macro is invoked, and as a result, "cmp r0, #99" fails to assemble. Obtained from: joerg at netbsd git-svn-id: svn://svn.freebsd.org/base/stable/10@275036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- contrib/binutils/gas/config/tc-arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/binutils/gas/config/tc-arm.c b/contrib/binutils/gas/config/tc-arm.c index 08dbb6fff..14c81a90c 100644 --- a/contrib/binutils/gas/config/tc-arm.c +++ b/contrib/binutils/gas/config/tc-arm.c @@ -6062,7 +6062,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.45.0