bug-gnulib
[Top][All Lists]
Advanced

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

Re: posixtm: doesn't like -1 for 32-bit time_t's?


From: Paul Eggert
Subject: Re: posixtm: doesn't like -1 for 32-bit time_t's?
Date: Wed, 20 Jun 2012 13:17:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 06/20/2012 10:43 AM, Simon Josefsson wrote:

> Has this test worked on any 32-bit time_t machines?

Sure, lots.

> 190112132045.51 return value mismatch: got 0, expected 1
> 
> and that time corresponds to (time_t) -1.  Any ideas?

That time is corresponds to -2147483649
(i.e., -2**31 - 1), not to -1.
On a host with 32-bit signed time_t, that test
case should be filtered out by this code:

      if (! (TYPE_MINIMUM (time_t) <= T[i].t_expected
             && T[i].t_expected <= TYPE_MAXIMUM (time_t)))
        {
          printf ("skipping %s: result is out of range of your time_t\n",
                  T[i].in);
          continue;
        }

because TYPE_MINIMUM (time_t) should evaluate to
-2**31, which is greater than -2**31 - 1.

Conversely, that filter did *not* work for
190112132045.52 (i.e., -2**31), as it complained
that the result is out of your time_t range, but
it is in range.

Can you debug the program to see why the filter isn't
working?  Perhaps disassemble it?  I wouldn't be surprised
if it were a compiler bug.



reply via email to

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