svn commit: r274856 - head/contrib/binutils/gas/config
Dimitry Andric
dim at FreeBSD.org
Sat Nov 22 16:30:32 UTC 2014
Author: dim
Date: Sat Nov 22 16:30:31 2014
New Revision: 274856
URL: https://svnweb.freebsd.org/changeset/base/274856
Log:
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
Modified:
head/contrib/binutils/gas/config/tc-arm.c
Modified: head/contrib/binutils/gas/config/tc-arm.c
==============================================================================
--- head/contrib/binutils/gas/config/tc-arm.c Sat Nov 22 16:27:51 2014 (r274855)
+++ head/contrib/binutils/gas/config/tc-arm.c Sat Nov 22 16:30:31 2014 (r274856)
@@ -6079,7 +6079,7 @@ parse_operands (char *str, const unsigne
/* 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. */
More information about the svn-src-head
mailing list