aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Earnshaw <Richard.Earnshaw@arm.com>2014-11-20 17:02:47 +0000
committerRichard Earnshaw <Richard.Earnshaw@arm.com>2014-11-20 17:02:47 +0000
commitd840c081f8082e8b9e63fead5306643975a97bb3 (patch)
treef2fc4d574252eaed4b212ec4d3118bb5e9ee5900
parentc22ee0ad9de7efff74942263c71b1878003e3eda (diff)
downloadgdb-d840c081f8082e8b9e63fead5306643975a97bb3.zip
gdb-d840c081f8082e8b9e63fead5306643975a97bb3.tar.gz
gdb-d840c081f8082e8b9e63fead5306643975a97bb3.tar.bz2
* config/tc-arm.c (rotate_left): Avoid undefined behaviour when N = 0.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-arm.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 97e5a9e..a9481f5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2014-11-20 Richard Earnshaw <rearnsha@arm.com>
+ * config/tc-arm.c (rotate_left): Avoid undefined behaviour when
+ N = 0.
+
+2014-11-20 Richard Earnshaw <rearnsha@arm.com>
+
* config/tc-aarch64.c (warn_unpredictable_ldst): Check that transfer
registers are in the GP register set. Adjust warnings. Use correct
field member for address register.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 5077f87..9100fb2 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -7251,7 +7251,7 @@ parse_operands (char *str, const unsigned int *pattern, bfd_boolean thumb)
/* Functions for operand encoding. ARM, then Thumb. */
-#define rotate_left(v, n) (v << n | v >> (32 - n))
+#define rotate_left(v, n) (v << (n & 31) | v >> ((32 - n) & 31))
/* If VAL can be encoded in the immediate field of an ARM instruction,
return the encoded form. Otherwise, return FAIL. */