libgcc2.c/longlong.h (on BITS_PER_UNIT != 8 CPUs)
Joel Sherrill
joel.sherrill@OARcorp.com
Thu Dec 16 11:20:00 GMT 1999
> The recent changes to libgcc2.c and longlong.h has broken targets
> where BITS_PER_UNIT is not 8 (eg. C4x).
>
> We end up with a test like the following in longlong.h that causes a
> parse error.
>
> #if (sizeof(int) * BITS_PER_UNIT) == 32
>
> Michael.
I tracked this down a little further. The problem occurs while
preprocessing.
sizeof(int) apparently can not be used there. Replacing the sizeof(int)
with
a constant number is enough to get rid of the compile error. The
offending
code sequence starts around line 132 in libgcc2.c:
#if BITS_PER_UNIT == 8
#define SI_TYPE_SIZE 32
#else
#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#endif
#define W_TYPE_SIZE SI_TYPE_SIZE
which is used around longlong.h around 109:
#if (defined (__a29k__) || defined (_AM29K)) && W_TYPE_SIZE == 32
^^^^^^^^^^^^^^^^^
On the c4x, BITS_PER_UNIT != 8, so the "^'ed" expression becomes what
Michael showed it to be above.
I would think the fix is to replace the "sizeof (SItype)" in this line
with a constant. Would one of the HOST_BITS_PER_XXX constants work
here?
#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
As far as I can see, this could cause problems on the 1750a, c4x, and
dsp16xx
ports. Perhaps this can be fixed by having hard-coded numbers like:
#if BITS_PER_UNIT == 8
#define SI_TYPE_SIZE 32
#elif BITS_PER_UNIT == 16
#define SI_TYPE_SIZE XXX
#elif BITS_PER_UNIT == 32
#define SI_TYPE_SIZE XXX
#else
#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#endif
This can't be hard to fix if one just knew the right value for the
XXX's in the above. Worst case, if could be conditional on the
CPU family for the non-8 cases.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the Gcc-bugs
mailing list