diff options
author | dim <dim@FreeBSD.org> | 2014-11-22 16:30:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-22 16:30:31 +0000 |
commit | b0c82ef0c167580db8d4e8de54454268c41a719a (patch) | |
tree | 6be99c4d4ffb7f9d56c0a0a8b773228ac73431b6 /contrib/binutils/gas | |
parent | b6dc63376d90cee3e96495640ed03a966e64f287 (diff) | |
download | FreeBSD-src-b0c82ef0c167580db8d4e8de54454268c41a719a.zip FreeBSD-src-b0c82ef0c167580db8d4e8de54454268c41a719a.tar.gz |
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
Diffstat (limited to 'contrib/binutils/gas')
-rw-r--r-- | contrib/binutils/gas/config/tc-arm.c | 2 |
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 8b470c0..37c2a90 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. */ |