summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-11-25 12:58:21 +0000
committerdim <dim@FreeBSD.org>2014-11-25 12:58:21 +0000
commitb7c69c9f14252044345f8178d764a2dbc054cebd (patch)
tree9326e4e109c76d1f9287a89dee6bc4c7dfe609f3
parent88dda701c62c1e22041e0d09b9a1464842527468 (diff)
downloadFreeBSD-src-b7c69c9f14252044345f8178d764a2dbc054cebd.zip
FreeBSD-src-b7c69c9f14252044345f8178d764a2dbc054cebd.tar.gz
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
-rw-r--r--contrib/binutils/gas/config/tc-arm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/binutils/gas/config/tc-arm.c b/contrib/binutils/gas/config/tc-arm.c
index 08dbb6f..14c81a9 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. */
OpenPOWER on IntegriCloud