bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] GNULIB mktime.c compilation failure on UNICOS 9.0 Cray Y-MP


From: Mark D. Baushke
Subject: [Bug-gnulib] GNULIB mktime.c compilation failure on UNICOS 9.0 Cray Y-MP EL
Date: Tue, 09 Nov 2004 21:38:55 -0800

Hi Folks,

It would seem that UNICOS 9.0 on a Cray Y-MP EL does not like the GNULIB
mktime.c file... (A friend of mine tried to compile the latest ccvs
sources on the box.)

The right_shift_propagates_sign expression: (-1 >> 1 == -1) ? 1 : -1)
apparently yeilds -1 and so the compilation fails.

I don't know if there is anything to be done given assumptions in the code
that the shift should work that way. I believe it is using a C90 compiler.

Section 6.3.7 Bitwise shift operators in the C90 standard says this:

    The resule of E1 >> E2 is E1 right-shifted E2 bit positions. If E1
    has an unsigned type or if E1 has a signed type and a nonnegative
    value, the value of the result is the integral part of the quotient
    of E1 divided by the quantity, 2 raised to the power of E2. If E1
    has a signed type and a negative value, the resulting value is
    implementation-defined.

So, we have here a case of an implementation-defined expression that is
not desirable for the mktime implementation.

        -- Mark

The mktime.c sources have the right_shift_propagates_sign on line 69
and the relevant macro and source line are here:
...
#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
...
verify (right_shift_propagates_sign, -1 >> 1 == -1);


% ./configure && make
... elided ...
checking for working mktime... no
... elided ...
checking for signed... yes
checking for wchar_t... yes
checking for wint_t... yes
checking for size_t... yes
checking for intmax_t... no
checking for inline... no
checking for stdint.h... (cached) no
checking for SIZE_MAX... 18446744073709551615U
checking for atexit... yes
checking for working POSIX fnmatch... yes
checking for struct tm.tm_zone... no
checking for tzname... yes
...
checking for char... yes
checking size of char... 1
checking for uniquely sized char... yes(1)
checking for short... yes
checking size of short... 8
checking for uniquely sized short... yes(8)
checking for int... yes
checking size of int... 8
checking for uniquely sized int... no
checking for long... yes
checking size of long... 8
checking for uniquely sized long... no
checking for size_t... (cached) yes
checking size of size_t... 8
checking for uniquely sized size_t... no
checking for ptrdiff_t... (cached) yes
checking size of ptrdiff_t... 8
checking for uniquely sized ptrdiff_t... no
checking for wint_t... yes
checking size of wint_t... 8
checking for uniquely sized wint_t... no
checking for float... yes
checking size of float... 8
checking for uniquely sized float... yes(8)
checking for double... yes
checking size of double... 8
checking for uniquely sized double... no
checking for long double... yes
checking size of long double... 16
checking for uniquely sized long double... yes(16)
...
source='mktime.c' object='mktime.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../depcomp \
cc -DHAVE_CONFIG_H -I. -I. -I..   -Ino/include  -g -c mktime.c
cc-445 cc: ERROR File = mktime.c, Line = 69
  The constant array dimension size is not a positive integral type.
cc-555 cc: ERROR File = mktime.c, Line = 69
  A member of a structure or union has an incomplete type.
cc-479 cc: ERROR File = mktime.c, Line = 69
  The "struct" or "union" "right_shift_propagates_sign" declaration has zero 
size.

TOTAL ERRORS DETECTED IN mktime.c: 3
make[2]: *** [mktime.o] Error 1
make[2]: Leaving directory `/home/alex/ccvs.20041109.215158/lib'
make[1]: *** [check] Error 2
make[1]: Leaving directory `/home/alex/ccvs.20041109.215158/lib'
make: *** [check-recursive] Error 1
...
% grep -i mktime config.h
/* Define to rpl_mktime if the replacement function should be used. */
#define mktime rpl_mktime
%

... extract from config.log ...
configure:11471: checking for working mktime
configure:11647: cc -o conftest -g   conftest.c  >&5
configure:11650: $? = 0
configure:11652: ./conftest
configure:11655: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "Concurrent Versions System (CVS)"
| #define PACKAGE_TARNAME "cvs"
| #define PACKAGE_VERSION "1.12.9.1"
| #define PACKAGE_STRING "Concurrent Versions System (CVS) 1.12.9.1"
| #define PACKAGE_BUGREPORT "address@hidden"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_UNISTD_H 1
| #define _GNU_SOURCE 1
| #define __EXTENSIONS__ 1
| #define PR_PROGRAM "/bin/pr"
| #define HAVE_DIRENT_H 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define RETSIGTYPE void
| #define HAVE_STRUCT_STAT_ST_BLKSIZE 1
| #define HAVE_STRUCT_STAT_ST_RDEV 1
| #define HAVE_DUP2 1
| #define HAVE_FTRUNCATE 1
| #define HAVE_MKDIR 1
| #define HAVE_READLINK 1
| #define HAVE_RENAME 1
| #define HAVE_STRSTR 1
| #define HAVE_STRTOUL 1
| #define HAVE_WAITPID 1
| #define HAVE_FCNTL_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_UNISTD_H 1
| #define select rpl_select
| #define C_ALLOCA 1
| #define CRAY_STACKSEG_END _getb67
| #define STACK_DIRECTION 1
| #define HAVE_STDLIB_H 1
| #define MALLOC_0_IS_NONNULL 0
| #define HAVE_LONG_DOUBLE 1
| #define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX 0
| #define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR 0
| #define mbstate_t int
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_WCTYPE_H 1
| #define HAVE_STRUCT_TIMESPEC 1
| #define HAVE_DECL_NANOSLEEP 0
| #define HAVE_ISASCII 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_MBLEN 1
| #define HAVE_TZSET 1
| #define HAVE_DECL_GETPASS 1
| #define HAVE_DECL_FFLUSH_UNLOCKED 0
| #define HAVE_DECL_FLOCKFILE 1
| #define HAVE_DECL_FPUTS_UNLOCKED 0
| #define HAVE_DECL_FUNLOCKFILE 1
| #define HAVE_DECL_PUTC_UNLOCKED 1
| #define _UINT32_T 1
| #define uint32_t unsigned short int
| #define UINT32_MAX 4294967295U
| #define WORDS_BIGENDIAN 1
| #define HAVE_DECL_GETENV 1
| #define uintmax_t unsigned long
| #define HAVE_STDLIB_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ALARM 1
| /* end confdefs.h.  */
| /* Test program from Paul Eggert and Tony Leneis.  */
| #if TIME_WITH_SYS_TIME
| # include <sys/time.h>
| # include <time.h>
| #else
| # if HAVE_SYS_TIME_H
| #  include <sys/time.h>
| # else
| #  include <time.h>
| # endif
| #endif
| 
| #if HAVE_STDLIB_H
| # include <stdlib.h>
| #endif
| 
| #if HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| 
| #if !HAVE_ALARM
| # define alarm(X) /* empty */
| #endif
| 
| /* Work around redefinition to rpl_putenv by other config tests.  */
| #undef putenv
| 
| static time_t time_t_max;
| static time_t time_t_min;
| 
| /* Values we'll use to set the TZ environment variable.  */
| static char *tz_strings[] = {
|   (char *) 0, "TZ=GMT0", "TZ=JST-9",
|   "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
| };
| #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
| 
| /* Fail if mktime fails to convert a date in the spring-forward gap.
|    Based on a problem report from Andreas Jaeger.  */
| static void
| spring_forward_gap ()
| {
|   /* glibc (up to about 1998-10-07) failed this test. */
|   struct tm tm;
| 
|   /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
|      instead of "TZ=America/Vancouver" in order to detect the bug even
|      on systems that don't support the Olson extension, or don't have the
|      full zoneinfo tables installed.  */
|   putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
| 
|   tm.tm_year = 98;
|   tm.tm_mon = 3;
|   tm.tm_mday = 5;
|   tm.tm_hour = 2;
|   tm.tm_min = 0;
|   tm.tm_sec = 0;
|   tm.tm_isdst = -1;
|   if (mktime (&tm) == (time_t)-1)
|     exit (1);
| }
| 
| static void
| mktime_test1 (now)
|      time_t now;
| {
|   struct tm *lt;
|   if ((lt = localtime (&now)) && mktime (lt) != now)
|     exit (1);
| }
| 
| static void
| mktime_test (now)
|      time_t now;
| {
|   mktime_test1 (now);
|   mktime_test1 ((time_t) (time_t_max - now));
|   mktime_test1 ((time_t) (time_t_min + now));
| }
| 
| static void
| irix_6_4_bug ()
| {
|   /* Based on code from Ariel Faigon.  */
|   struct tm tm;
|   tm.tm_year = 96;
|   tm.tm_mon = 3;
|   tm.tm_mday = 0;
|   tm.tm_hour = 0;
|   tm.tm_min = 0;
|   tm.tm_sec = 0;
|   tm.tm_isdst = -1;
|   mktime (&tm);
|   if (tm.tm_mon != 2 || tm.tm_mday != 31)
|     exit (1);
| }
| 
| static void
| bigtime_test (j)
|      int j;
| {
|   struct tm tm;
|   time_t now;
|   tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 
j;
|   now = mktime (&tm);
|   if (now != (time_t) -1)
|     {
|       struct tm *lt = localtime (&now);
|       if (! (lt
|            && lt->tm_year == tm.tm_year
|            && lt->tm_mon == tm.tm_mon
|            && lt->tm_mday == tm.tm_mday
|            && lt->tm_hour == tm.tm_hour
|            && lt->tm_min == tm.tm_min
|            && lt->tm_sec == tm.tm_sec
|            && lt->tm_yday == tm.tm_yday
|            && lt->tm_wday == tm.tm_wday
|            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
|                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
|       exit (1);
|     }
| }
| 
| int
| main ()
| {
|   time_t t, delta;
|   int i, j;
| 
|   /* This test makes some buggy mktime implementations loop.
|      Give up after 60 seconds; a mktime slower than that
|      isn't worth using anyway.  */
|   alarm (60);
| 
|   for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
|     continue;
|   time_t_max--;
|   if ((time_t) -1 < 0)
|     for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
|       continue;
|   delta = time_t_max / 997; /* a suitable prime number */
|   for (i = 0; i < N_STRINGS; i++)
|     {
|       if (tz_strings[i])
|       putenv (tz_strings[i]);
| 
|       for (t = 0; t <= time_t_max - delta; t += delta)
|       mktime_test (t);
|       mktime_test ((time_t) 1);
|       mktime_test ((time_t) (60 * 60));
|       mktime_test ((time_t) (60 * 60 * 24));
| 
|       for (j = 1; 0 < j; j *= 2)
|       bigtime_test (j);
|       bigtime_test (j - 1);
|     }
|   irix_6_4_bug ();
|   spring_forward_gap ();
|   exit (0);
| }
configure:11669: result: no
configure:11682: checking for C/C++ restrict keyword
configure:11700: cc -c -g  conftest.c >&5
configure:11706: $? = 0
configure:11710: test -z 
                         || test ! -s conftest.err
configure:11713: $? = 0
configure:11716: test -s conftest.o
configure:11719: $? = 0
configure:11731: result: restrict
configure:11765: checking for inttypes.h
configure:11788: cc -c -g  conftest.c >&5
cc-315 cc: ERROR File = conftest.c, Line = 86
  The include file "inttypes.h" is unavailable.

TOTAL ERRORS DETECTED IN conftest.c: 1
configure:11794: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "Concurrent Versions System (CVS)"
| #define PACKAGE_TARNAME "cvs"
| #define PACKAGE_VERSION "1.12.9.1"
| #define PACKAGE_STRING "Concurrent Versions System (CVS) 1.12.9.1"
| #define PACKAGE_BUGREPORT "address@hidden"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_UNISTD_H 1
| #define _GNU_SOURCE 1
| #define __EXTENSIONS__ 1
| #define PR_PROGRAM "/bin/pr"
| #define HAVE_DIRENT_H 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define RETSIGTYPE void
| #define HAVE_STRUCT_STAT_ST_BLKSIZE 1
| #define HAVE_STRUCT_STAT_ST_RDEV 1
| #define HAVE_DUP2 1
| #define HAVE_FTRUNCATE 1
| #define HAVE_MKDIR 1
| #define HAVE_READLINK 1
| #define HAVE_RENAME 1
| #define HAVE_STRSTR 1
| #define HAVE_STRTOUL 1
| #define HAVE_WAITPID 1
| #define HAVE_FCNTL_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_UNISTD_H 1
| #define select rpl_select
| #define C_ALLOCA 1
| #define CRAY_STACKSEG_END _getb67
| #define STACK_DIRECTION 1
| #define HAVE_STDLIB_H 1
| #define MALLOC_0_IS_NONNULL 0
| #define HAVE_LONG_DOUBLE 1
| #define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX 0
| #define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR 0
| #define mbstate_t int
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_WCTYPE_H 1
| #define HAVE_STRUCT_TIMESPEC 1
| #define HAVE_DECL_NANOSLEEP 0
| #define HAVE_ISASCII 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_MBLEN 1
| #define HAVE_TZSET 1
| #define HAVE_DECL_GETPASS 1
| #define HAVE_DECL_FFLUSH_UNLOCKED 0
| #define HAVE_DECL_FLOCKFILE 1
| #define HAVE_DECL_FPUTS_UNLOCKED 0
| #define HAVE_DECL_FUNLOCKFILE 1
| #define HAVE_DECL_PUTC_UNLOCKED 1
| #define _UINT32_T 1
| #define uint32_t unsigned short int
| #define UINT32_MAX 4294967295U
| #define WORDS_BIGENDIAN 1
| #define HAVE_DECL_GETENV 1
| #define uintmax_t unsigned long
| #define HAVE_STDLIB_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ALARM 1
| /* end confdefs.h.  */
| #include <sys/types.h>
| #include <inttypes.h>
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:11819: result: no
configure:11833: checking for strftime
configure:11890: cc -o conftest -g   conftest.c  >&5
configure:11896: $? = 0
configure:11900: test -z 
                         || test ! -s conftest.err
configure:11903: $? = 0
configure:11906: test -s conftest
configure:11909: $? = 0
configure:11921: result: yes
configure:12007: checking whether tzset clobbers localtime buffer
configure:12055: cc -o conftest -g   conftest.c  >&5
configure:12058: $? = 0
configure:12060: ./conftest
configure:12063: $? = 0
configure:12077: result: no
... extract from config.log ...




reply via email to

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