bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT


From: Bruno Haible
Subject: [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT
Date: Wed, 24 Oct 2007 03:21:55 +0200
User-agent: KMail/1.5.4

Paul Eggert wrote:
> > 2007-10-22  Bruno Haible  <address@hidden>
> >
> >     * m4/ulonglong.m4 (AC_TYPE_UNSIGNED_LONG_LONG_INT): Use -1ull, not
> >     -1u, in preprocessor expression.
> 
> Thanks for checking that.  I installed that fix into gnulib, and a
> similar patch into autoconf.

Thanks, this fixes it on HP-UX 11.00. Now a similar problem exists on
Solaris 10, with the Sun C 5.0, 5.6, 5.7, 5.8 compilers.

$ cc -V
cc: WorkShop Compilers 5.0 98/12/15 C 5.0
usage: cc [ options] files.  Use 'cc -flags' for details

Here the autoconf tests detect the opposite situation, that "unsigned long long"
works (regardless with or without the HP-UX fix) but "long long" doesn't.
config.h contains this:

/* #undef HAVE_LONG_LONG_INT */
#define HAVE_UNSIGNED_LONG_LONG_INT 1

$ cat u.c
#if ! (18446744073709551615ULL <= -1ull)
   error in preprocessor;
#endif
$ cc -O -c u.c
"u.c", line 4: warning: empty translation unit

$ cat i.c
#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
   error in preprocessor;
#endif
$ cc -O -c i.c
"i.c", line 2: undefined or not a type: error
"i.c", line 2: syntax error before or at: in
"i.c", line 2: undefined or not a type: in
"i.c", line 2: warning: old-style declaration or incorrect type for: 
preprocessor
cc: acomp failed for i.c

$ cat i.c
#if ! (-2147483647LL < 0)
   error in preprocessor;
#endif
#if ! (-2147483648LL < 0)
   error in preprocessor;
#endif
#if ! (-9223372036854775807LL < 0)
   error in preprocessor;
#endif
$ cc -O -c i.c
"i.c", line 5: undefined or not a type: error
"i.c", line 5: syntax error before or at: in
"i.c", line 5: undefined or not a type: in
"i.c", line 5: warning: old-style declaration or incorrect type for: 
preprocessor
"i.c", line 8: undefined or not a type: error
"i.c", line 8: syntax error before or at: in
"i.c", line 8: undefined or not a type: in
"i.c", line 8: warning: old-style declaration or incorrect type for: 
preprocessor
cc: acomp failed for i.c

So, here apparently, for some x >= 2^31,  "-xLL < 0"  evaluates to false.

Again, as for the HP-UX case, I would prefer to loosen the preprocessor
checks, and instead document in autoconf's manual that
  - [the HP-UX cc bug] some preprocessors evaluate preprocessor expressions
    in the integer width specified by the literals, like the C compiler proper,
    rather than in uintmax_t width, as specified by ISO C99,
  - [the Sun cc bug] some preprocessors don't support -xLL where x >= 2^31.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]