[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3
From: |
Gary V. Vaughan |
Subject: |
Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3 |
Date: |
Mon, 2 May 2011 19:09:38 +0700 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi Paul,
Thanks for following up.
On Sun, May 01, 2011 at 10:52:48AM -0700, Paul Eggert wrote:
> On 05/01/11 10:15, Gary V. Vaughan wrote:
> > $ cat ,t.c
> > #include <stdint.h>
> > #include "intprops.h"
> > int main (int argc, char **argv) {
> > printf("%lu\n", (unsigned long) ULONG_MAX);
> > printf("%lu\n", (unsigned long) UINT_FAST8_MAX);
> > return 0;
> > }
> > $ cc -I. -I../lib -o ,t ,t.c && ./,t
> > 4294967295
> > 4294967295
> > $ cc -I. -I../lib +DD64 -o ,t ,t.c && ./,t
> > 18446744073709551615
> > 4294967295
> >
> > I have no idea why or how that is happening though :(
>
> Surely the '#include "intprops.h"' is unnecessary in the
> above example, since 'main' uses only symbols that are
> defined by stdint.h. However, it may be that '#include
> <stdio.h>' is needed for proper operation.
Oh yes, sorry. I was editing the same test file and didn't
re-check the dependencies.
> Could you
> try that test again, without intprops.h, but with
> stdio.h?
No difference; the outputs are identical with the change of
header file:
$ pwd
/opt/build/libunistring-0.9.3/tests
$ cat ,t.c
#include <stdint.h>
#include <stdio.h>
int main (int argc, char **argv) {
printf("%lu\n", (unsigned long) ULONG_MAX);
printf("%lu\n", (unsigned long) UINT_FAST8_MAX);
return 0;
}
$ cc -I. -I../lib -o ,t ,t.c && ./,t
4294967295
4294967295
$ cc -I. -I../lib +DD64 -o ,t ,t.c && ./,t
18446744073709551615
4294967295
And using only the system headers:
$ cc -o ,t ,t.c && ./,t
4294967295
4294967295
$ cc +DD64 -o ,t ,t.c && ./,t
18446744073709551615
4294967295
> Which include file in HP-UX defines UINT_FAST8_MAX?
$ find /usr/include -name '*.h' -exec fgrep -l UINT_FAST8_MAX {} \;
/usr/include/stdint.h
$ grep UINT_FAST8_MAX /usr/include/stdint.h
# define UINT_FAST8_MAX UINT_MAX
$ find /usr/include -name '*.h' -exec fgrep -l UINT_MAX {} \;
/usr/include/limits.h
/usr/include/stdint.h
/usr/include/wchar.h
$ grep UINT_MAX `find /usr/include -name '*.h' -exec fgrep -l UINT_MAX {} \;`
/usr/include/limits.h:# define UINT_MAX 4294967295U /* max value of
an unsigned integer */
/usr/include/limits.h:# define UINT_MAX 037777777777 /* max value of
an unsigned integer */
/usr/include/limits.h:# define USI_MAX UINT_MAX /* max
decimal value of an unsigned
/usr/include/stdint.h:# define UINT_LEAST32_MAX UINT_MAX
/usr/include/stdint.h:# define UINT_FAST8_MAX UINT_MAX
/usr/include/stdint.h:# define UINT_FAST16_MAX UINT_MAX
/usr/include/stdint.h:# define UINT_FAST32_MAX UINT_MAX
/usr/include/stdint.h:# define SIG_ATOMIC_MAX UINT_MAX
/usr/include/stdint.h:# define WCHAR_MAX UINT_MAX
/usr/include/stdint.h:# define WINT_MAX UINT_MAX
/usr/include/wchar.h:# include <limits.h> /* UINT_MAX */
/usr/include/wchar.h:# define WCHAR_MAX UINT_MAX /* max value
of an unsigned integer */
/usr/include/wchar.h:# define WCHAR_MAX (wchar_t)UINT_MAX /*
max value of an unsigned integer */
> Perhaps
> that include file is clashing with gnulib's stdint.h. For
> example, it could be that <limits.h> (which intprops.h includes)
> redefines UINT_FAST8_MAX to the wrong value.
That seems to me to be what is happening. Is this something that gnulib
stdint.h can fix? It looks like a stupid mistake on the part of the
HPUX headers. If you concur, I'll also report it back upstream so that
later compiler patch levels might be fixed in due course.
> Also, which include file in HP-UX defines uint_fast8_t,
> and what does it define it to?
$ find /usr/include -name '*.h' -exec fgrep -l uint_fast8_t {} \;
/usr/include/sys/_inttypes.h
$ grep uint_fast8_t /usr/include/sys/_inttypes.h
typedef unsigned int uint_fast8_t;
$ fgrep -l sys/_inttypes.h /usr/include/*.h
/usr/include/crt0.h
/usr/include/curses.h
/usr/include/dial.h
/usr/include/grp.h
/usr/include/inttypes.h
/usr/include/lc_core.h
/usr/include/localedef.h
/usr/include/model.h
/usr/include/stddef.h
/usr/include/stdint.h
/usr/include/string.h
/usr/include/term.h
/usr/include/time.h
/usr/include/utmp.h
/usr/include/utmps.h
/usr/include/utmpx.h
/usr/include/values.h
Hmm... so the root of the problem is that with the 64bit ABI, ULONG_MAX
is promoted to 2**64-1, where UINT_FAST8_MAX is always 2**32-1 to match
unsigned int declaration of uint_fast8_t - irrespective of ABI.
And yet, ia64*-hpux11.31 shows the same results as above, save that I
need to add '#include <limits.h>' to get a ULONG_MAX definition, and
that the original bug I reported at the start of this thread isn't
triggered here!
Cheers,
--
Gary V. Vaughan (gary AT gnu DOT org)
pgptQdhHcSgps.pgp
Description: PGP signature
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Gary V. Vaughan, 2011/05/01
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Paul Eggert, 2011/05/01
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Gary V. Vaughan, 2011/05/01
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Paul Eggert, 2011/05/01
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Gary V. Vaughan, 2011/05/01
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Paul Eggert, 2011/05/01
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3,
Gary V. Vaughan <=
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Paul Eggert, 2011/05/02
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Gary V. Vaughan, 2011/05/03
- Re: verify fails on ia64-hpux11.23 in libunistring-0.9.3, Paul Eggert, 2011/05/03