aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-22 16:30:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-22 16:30:31 +0000
commit5008830b518e5629416dedb218cf34003eec3ce1 (patch)
tree6be99c4d4ffb7f9d56c0a0a8b773228ac73431b6 /contrib
parent08dc8cf90c71ffa0bf53ec2a326733f36e01b40e (diff)
downloadsrc-5008830b518e5629416dedb218cf34003eec3ce1.tar.gz
src-5008830b518e5629416dedb218cf34003eec3ce1.zip
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 MFC after: 3 days
Notes
Notes: svn path=/head/; revision=274856
Diffstat (limited to 'contrib')
-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 8b470c0335e0..37c2a9075013 100644
--- a/contrib/binutils/gas/config/tc-arm.c
+++ b/contrib/binutils/gas/config/tc-arm.c
@@ -6079,7 +6079,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. */