autoconf-patches
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] FYI: use of bool provokes HP ia64 /bin/cc compiler bug?


From: Paul Eggert
Subject: Re: [Bug-gnulib] FYI: use of bool provokes HP ia64 /bin/cc compiler bug?
Date: Mon, 31 May 2004 22:37:35 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Jim Meyering <address@hidden> writes:

>     #include <stdio.h>
>     #include <stdlib.h>
>     #define N 256
>     int
>     main ()
>     {
>       _Bool a[N];
>       printf ("%d %d\n", sizeof a, N * sizeof (a[0]));
>       exit (0);
>     }
>
> Of course, the two numbers should be the same.
> But here they're not:
>
>     $ /bin/cc k.c && ./a.out
>     256 1024
>
> More details:
>
>     $ /bin/cc -V
>     cc: HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]
>
> config.guess reports this:
>
>     ia64-hp-hpux11.23
>
> This was on host spe173.testdrive.hp.com.

Thanks for reporting that.  I've installed the following patch to
Autoconf in an attempt to detect this, and I'll install a similar
patch to gnulib's copy of the stdbool macro.  This isn't a complete
fix to the bug, but it's a start.

2004-05-31  Paul Eggert  <address@hidden>

        * lib/autoconf/headers.m4 (HAVE_STDBOOL_H): Detect _Bool bug
        in HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003].  Problem reported
        by Jim Meyering.

Index: lib/autoconf/headers.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/headers.m4,v
retrieving revision 1.40
diff -p -u -r1.40 headers.m4
--- lib/autoconf/headers.m4     3 May 2004 20:15:44 -0000       1.40
+++ lib/autoconf/headers.m4     1 Jun 2004 05:32:05 -0000
@@ -530,8 +530,14 @@ AC_DEFUN([AC_HEADER_STDBOOL],
        char g[true];
        char h[sizeof (_Bool)];
        char i[sizeof s.t];
+       enum { j = false, k = true, l = false * true, m = true * 256 };
+       _Bool n[m];
+       char o[sizeof n == m * sizeof n[0] ? 1 : -1];
       ]],
-      [[ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ]])],
+      [[
+        return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !j + !k + !l
+                + !m + !n + !o);
+      ]])],
       [ac_cv_header_stdbool_h=yes],
       [ac_cv_header_stdbool_h=no])])
 AC_CHECK_TYPES([_Bool])




reply via email to

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