[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error compiling regex gnulib module with pgcc compiler
From: |
Paul Eggert |
Subject: |
Re: error compiling regex gnulib module with pgcc compiler |
Date: |
Thu, 05 Jan 2006 10:40:26 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> This is pgcc 6.0-8 64-bit target on x86-64 Linux, but as indicated
> above, the issue is present in 5.2-1 as well.
Thanks for checking that. Can you please run the following
program on that platform and send us the output? If it outputs
"preprocessor thinks BITSET_WORD_BITS = 64", then we have an
obvious fix to regex_internal.h. Thanks.
#include <limits.h>
/* Maximum value of a bitset word. It must be useful in preprocessor
contexts, and must be consistent with bitset_word. */
#define BITSET_WORD_MAX ULONG_MAX
/* Number of bits in a bitset word. Avoid greater-than-32-bit
integers and unconditional shifts by more than 31 bits, as they're
not portable. */
#if BITSET_WORD_MAX == 0xffffffff
# define BITSET_WORD_BITS 32
#elif BITSET_WORD_MAX >> 31 >> 5 == 1
# define BITSET_WORD_BITS 36
#elif BITSET_WORD_MAX >> 31 >> 16 == 1
# define BITSET_WORD_BITS 48
#elif BITSET_WORD_MAX >> 31 >> 28 == 1
# define BITSET_WORD_BITS 60
#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1
# define BITSET_WORD_BITS 64
#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1
# define BITSET_WORD_BITS 72
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1
# define BITSET_WORD_BITS 128
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1
# define BITSET_WORD_BITS 256
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1
# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */
# if BITSET_WORD_BITS <= SBC_MAX
# error "Invalid SBC_MAX"
# endif
#elif BITSET_WORD_MAX == (0xffffffff + 2) * 0xffffffff
/* Work around a bug in PGC GNU/Linux x86-64 5.2-1 and 6.0-8 (and
probably other versions), where the preprocessor mishandles large
unsigned values and thinks they are signed. */
# define BITSET_WORD_BITS 64
#else
# error "Add case for new bitset_word size"
#endif
#include <stdio.h>
int main(void)
{
printf("ULONG_MAX = %lu\nsizeof(ulong) = %lu\n", ULONG_MAX,
(unsigned long) sizeof(unsigned long));
printf("%lu\n", BITSET_WORD_MAX >> 31 >> 31 >> 1);
printf("BITSET_WORD_BITS = %d\n", BITSET_WORD_BITS);
#if BITSET_WORD_BITS == 32
printf("preprocessor thinks BITSET_WORD_BITS = 32\n");
#elif BITSET_WORD_BITS == 64
printf("preprocessor thinks BITSET_WORD_BITS = 64\n");
#else
printf("preprocessor has some other value for BITSET_WORD_BITS\n");
#endif
return 0;
}