bug-gnulib
[Top][All Lists]
Advanced

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

Re: CLISP build fails in mktime


From: Bruno Haible
Subject: Re: CLISP build fails in mktime
Date: Thu, 17 Sep 2009 08:08:24 +0200
User-agent: KMail/1.9.9

Hi,

On 2009-08-30 I asked Paul Eggert:
> static inline time_t
> ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
>           int year0, int yday0, int hour0, int min0, int sec0)
> {
>   verify (C99_integer_division, -1 / 2 == 0);
>   verify (long_int_year_and_yday_are_wide_enough,
>         INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
> 
> The failing assertion is the second one.
> 
> The situation is that 'int' and 'long' are 32-bit, but 'time_t' is 64-bit.
> 
> Why is that verify() there? If the code is supposed to be correct when
> 'int' and 'long' are 32-bit and 'time_t' is 32-bit as well, why would
> changing 'time_t' to 64-bit cause a problem? Recall that
>   - time_t is the output type, not the input type,
>   - the caller verifies the result against overflow,
>   - the year1 and yday1 arguments are computed from 'int' values.

No one answered. So, assuming that my understanding is correct that nothing
can go wrong when 'time_t' is 64 bit large, I'm disabling this assertion:


2009-09-17  Bruno Haible  <address@hidden>

        Disable assertion that fails on NetBSD 5 / i386.
        * lib/mktime.c (ydhms_diff): Disable assertion about time_t size.
        Reported by Sam Steingold <address@hidden>
        and Hasso Tepper <address@hidden>.

--- lib/mktime.c.orig   2009-09-17 08:03:02.000000000 +0200
+++ lib/mktime.c        2009-09-17 08:01:05.000000000 +0200
@@ -1,5 +1,5 @@
 /* Convert a `struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2005, 2006, 2007 Free Software Foundation, 
Inc.
+   Copyright (C) 1993-1999, 2002-2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <address@hidden>.
 
@@ -165,8 +165,11 @@
            int year0, int yday0, int hour0, int min0, int sec0)
 {
   verify (C99_integer_division, -1 / 2 == 0);
+#if 0 /* This assertion fails on 32-bit systems with 64-bit time_t, such as
+         NetBSD 5 on i386.  */
   verify (long_int_year_and_yday_are_wide_enough,
          INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
+#endif
 
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid integer overflow here.  */




reply via email to

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