[PATCH] Fix for the bootstrap break I caused
Segher Boessenkool
segher@kernel.crashing.org
Sat Jun 5 22:27:00 GMT 2010
My "trivial" patch (r160307) caused breakage on all big-endian
hosts. Ouch. This fixes it.
gcc/ChangeLog
2010-06-06 Segher Boessenkool <segher@kernel.crashing.org>
PR bootstrap/44427
PR bootstrap/44428
genautomata.c (SET_BIT, CLEAR_BIT, TEST_BIT): Make these macros
endianness-independent.
---
gcc/genautomata.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index ad7caa6..f7493c7 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -3314,15 +3314,18 @@ finish_alt_states (void)
/* Set bit number bitno in the bit string. The macro is not side
effect proof. */
#define SET_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] |= 1 << (bitno) % CHAR_BIT)
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] |= \
+ (HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))
#define CLEAR_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] &= ~(1 << (bitno) % CHAR_BIT))
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] &= \
+ ~((HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)))
/* Test if bit number bitno in the bitstring is set. The macro is not
side effect proof. */
-#define TEST_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] >> (bitno) % CHAR_BIT & 1)
+#define TEST_BIT(bitstring, bitno) \
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] >> \
+ (bitno) % (sizeof (*(bitstring)) * CHAR_BIT) & 1)
--
1.7.0.2.183.g14cec
More information about the Gcc-patches
mailing list