This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix for the bootstrap break I caused
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: vmakarov at redhat dot com, Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Sun, 6 Jun 2010 00:27:04 +0200
- Subject: [PATCH] Fix for the bootstrap break I caused
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