0007-tcarm.diff 800 B

123456789101112131415161718192021
  1. From d840c081f8082e8b9e63fead5306643975a97bb3 Mon Sep 17 00:00:00 2001
  2. From: Richard Earnshaw <[email protected]>
  3. Date: Thu, 20 Nov 2014 17:02:47 +0000
  4. Subject: [PATCH] * config/tc-arm.c (rotate_left): Avoid undefined behaviour
  5. when N = 0.
  6. ---
  7. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
  8. index 5077f87..9100fb2 100644
  9. --- a/gas/config/tc-arm.c
  10. +++ b/gas/config/tc-arm.c
  11. @@ -7251,7 +7251,7 @@ parse_operands (char *str, const unsigned int *pattern, bfd_boolean thumb)
  12. /* Functions for operand encoding. ARM, then Thumb. */
  13. -#define rotate_left(v, n) (v << n | v >> (32 - n))
  14. +#define rotate_left(v, n) (v << (n & 31) | v >> ((32 - n) & 31))
  15. /* If VAL can be encoded in the immediate field of an ARM instruction,
  16. return the encoded form. Otherwise, return FAIL. */