autoconf-patches
[Top][All Lists]
Advanced

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

FYI: autoconf patch to work around HP-UX 11.11 compiler bug


From: Paul Eggert
Subject: FYI: autoconf patch to work around HP-UX 11.11 compiler bug
Date: Thu, 18 Oct 2001 16:58:49 -0700 (PDT)

> Date: Thu, 18 Oct 2001 14:13:07 -0700 (PDT)
> From: Kevin Steves <address@hidden>
> 
> On Thu, 18 Oct 2001, Paul Eggert wrote:
> :int a1[1 - 2 * !((unsigned long)(sizeof(unsigned char)) >= 1)];
> :int a2[1 - 2 * !((unsigned long)(sizeof(unsigned char)) <  1)];
> :int a3[1 - 2 * !((         long)(sizeof(unsigned char)) >= 1)];
> :int a4[1 - 2 * !((         long)(sizeof(unsigned char)) <  1)];
> 
> cc: "f2.c", line 2: error 1504: A zero or negative array size is illegal.
> cc: "f2.c", line 4: error 1504: A zero or negative array size is illegal.

Thanks for the info.  That suggests the following simple Autoconf
workaround, which I've taken the liberty of checking into the Autoconf
CVS tree.  It fixes the cross-compile problem you uncovered which
causes Autoconf's "make check" to loop on HP-UX 11.11.  Native
compiles should work OK already.  This patch should appear in the next
Autoconf release.

If I recall correctly, this fixes all the problems with Autoconf that
were exposed by openssh-2.9.9p2.

2001-10-18  Paul Eggert  <address@hidden>

        * lib/autoconf/types.m4 (AC_CHECK_SIZEOF): Cast sizeof to unsigned
        long, to work around a bug in the HP C compiler version HP92453-01
        B.11.11.23709.GP.

--- lib/autoconf/types.m4       2001/10/10 12:58:44     1.12
+++ lib/autoconf/types.m4       2001/10/18 23:25:05
@@ -352,7 +352,11 @@ AC_DEFUN([AC_CHECK_SIZEOF],
 AC_CHECK_TYPE([$1], [], [], [$3])
 AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]),
 [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
-  _AC_COMPUTE_INT([sizeof ($1)],
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  _AC_COMPUTE_INT([(unsigned long) (sizeof ($1))],
                   [AS_TR_SH([ac_cv_sizeof_$1])],
                   [AC_INCLUDES_DEFAULT([$3])],
                   [AC_MSG_ERROR([cannot compute sizeof ($1), 77])])



reply via email to

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