Diff below removes undefined behaviour from the rotate_left() macro.
>From NetBSD via FreeBSD.  The fix is different from the fix in the
upstream GPLv3 codebase.

ok?


Index: gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c,v
retrieving revision 1.7
diff -u -p -r1.7 tc-arm.c
--- gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c       7 Nov 2017 01:18:05 
-0000       1.7
+++ gnu/usr.bin/binutils-2.17/gas/config/tc-arm.c       11 Dec 2017 14:54:47 
-0000
@@ -4266,7 +4266,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.  */

Reply via email to