"Peter O'Gorman" <[EMAIL PROTECTED]> writes: > The HP-UX 10.20 compiler is documented to fail on switch statements with > 64 bit values, so yes, that test causes it to crash. However, the > problem only occurs with re_search which returns a regoff_t which is an > off_t which is, correctly, 64 bits. Please don't use this test in > configure.
I wasn't thinking of changing off_t's width, as that would cause many programs to mishandle large files on HP-UX 10.20. I was thinking merely of changing regoff_t's width, as that will merely cause programs to mishandle strings larger than 2 GiB when processing regular expressions -- an acceptable limitation, I think, for that old platform. In an attempt to fix this problem I installed the following patch in both coreutils and gnulib. 2005-12-01 Paul Eggert <[EMAIL PROTECTED]> * m4/regex.m4 (gl_REGEX): Check whether off_t can be used in a switch statement, to work around an HP-UX 10.20 compiler bug reported by Peter O'Gorman. Index: regex.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/regex.m4,v retrieving revision 1.46 diff -p -u -r1.46 regex.m4 --- regex.m4 23 Sep 2005 21:18:20 -0000 1.46 +++ regex.m4 2 Dec 2005 00:29:31 -0000 @@ -1,4 +1,4 @@ -#serial 30 +#serial 31 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free # Software Foundation, Inc. @@ -15,8 +15,29 @@ AC_PREREQ([2.50]) AC_DEFUN([gl_REGEX], [ AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t - AC_DEFINE([_REGEX_LARGE_OFFSETS], 1, - [Define if you want regoff_t to be at least as wide POSIX requires.]) + + AC_CACHE_CHECK([whether off_t can be used in a switch statement], + [gl_cv_type_off_t_switch], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[off_t o = -1; + switch (o) + { + case -2: + return 1; + case -1: + return 2; + default: + return 0; + } + ]])], + [gl_cv_type_off_t_switch=yes], + [gl_cv_type_off_t_switch=no])]) + if test $gl_cv_type_off_t_switch = yes; then + AC_DEFINE([_REGEX_LARGE_OFFSETS], 1, + [Define if you want regoff_t to be at least as wide POSIX requires.]) + fi AC_LIBSOURCES( [regcomp.c, regex.c, regex.h, _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib