[PATCH] Correct timespec implementation [BZ #26232]

H.J. Lu hjl.tools@gmail.com
Mon Jul 13 23:30:18 GMT 2020


On Sat, Jul 11, 2020 at 9:31 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, Jul 11, 2020 at 7:45 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Fri, Jul 10, 2020 at 4:10 PM Tulio Magno Quites Machado Filho
> > <tuliom@ascii.art.br> wrote:
> > >
> > > Carlos O'Donell via Libc-alpha <libc-alpha@sourceware.org> writes:
> > >
> > > > OK for master. I'd like to see this fixed in glibc 2.32.
> > > > Thank you for fixing the test case!
> > > >
> > > > Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> > >
> > > Pushed as 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f.
> > >
> >
> > support/tst-timespec failed on i686 and x32:
> >
> > Test case 10
> > tst-timespec.c:312: numeric comparison failure
> >    left: 0 (0x0); from: support_timespec_check_in_range
> > (check_cases[i].expected, check_cases[i].observed,
> > check_cases[i].lower_bound, check_cases[i].upper_bound)
> >   right: 1 (0x1); from: check_cases[i].result
> > Test case 11
> >
>
> Usage of long may be the problem.
>

commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f
Author: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
Date:   Fri Jul 10 19:41:06 2020 -0300

    Fix time/tst-cpuclock1 intermitent failures

has 2 issues:

1. It assumes time_t == long which is false on x32.
2. tst-timespec.c is compiled without -fexcess-precision=standard which
generates incorrect results on i686 in support_timespec_check_in_range:

  double ratio = (double)observed_norm / expected_norm;
  return (lower_bound <= ratio && ratio <= upper_bound);

This patch does

1. Compile tst-timespec.c with -fexcess-precision=standard.
2. Replace long with time_t.
3. Replace LONG_MIN and LONG_MAX with TYPE_MINIMUM (time_t) and
TYPE_MAXIMUM (time_t).

OK for master?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Correct-timespec-implementation-BZ-26232.patch
Type: text/x-patch
Size: 11377 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200713/6ceda9b4/attachment.bin>


More information about the Libc-alpha mailing list