* tests/test.c (bm_huge): Make array size depend on word size
(5 elements for 64-bit targets); initialize elements (except the last
one) to -1 instead of 0xffffffff (so that all bits are ones even on
a 64-bit target); initialize last element to ((word)-1)>>8 instead of
0x00ffffff value.
* tests/test.c (typed_test): Fail if bm_huge descriptor contains wrong
bit values at certain positions (as it had before this fix).
unsigned n_tests = 0;
-const GC_word bm_huge[10] = {
+const GC_word bm_huge[320 / CPP_WORDSZ] = {
+# if CPP_WORDSZ == 32
0xffffffff,
0xffffffff,
0xffffffff,
0xffffffff,
0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0x00ffffff,
+# endif
+ (GC_signed_word)-1,
+ (GC_signed_word)-1,
+ (GC_signed_word)-1,
+ (GC_signed_word)-1,
+ ((GC_word)((GC_signed_word)-1)) >> 8 /* highest byte is zero */
};
/* A very simple test of explicitly typed allocation */
(void)GC_make_descriptor(&bm_large, 32);
# endif
collectable_count++;
+ if (GC_get_bit(bm_huge, 32) == 0 || GC_get_bit(bm_huge, 311) == 0
+ || GC_get_bit(bm_huge, 319) != 0) {
+ GC_printf("Bad GC_get_bit() or bm_huge initialization\n");
+ FAIL;
+ }
old = 0;
for (i = 0; i < 4000; i++) {
collectable_count++;