diff options
author | Alexandre Oliva <oliva@adacore.com> | 2024-09-02 11:31:59 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2024-09-02 11:31:59 -0300 |
commit | 410061b15a9b0a464c851173fa568e49c85570dc (patch) | |
tree | 7a88b14b5c8cb25a2b497e2c141953f9a5a26af0 /gcc/fold-const.cc | |
parent | 9223d1715918e4e8e7a59471b228f815b4a3467c (diff) | |
download | gcc-410061b15a9b0a464c851173fa568e49c85570dc.zip gcc-410061b15a9b0a464c851173fa568e49c85570dc.tar.gz gcc-410061b15a9b0a464c851173fa568e49c85570dc.tar.bz2 |
[libstdc++] [testsuite] avoid async.cc loss of precision [PR91486]
When we get to test_pr91486_wait_until(), we're about 10s past the
float_steady_clock epoch. This is enough for the 1s delta for the
timeout to come out slightly lower when the futex-less wait_until
converts the deadline from float_steady_clock to __clock_t. So we may
wake up a little too early, and end up looping one extra time to sleep
for e.g. another 954ns until we hit the deadline.
Each iteration calls float_steady_clock::now(), bumping the call_count
that we VERIFY() at the end of the subtest. Since we expect at most 3
calls, and we're going to have at the very least 3 on futex-less
targets (one in the test proper, one before wait_until_impl to compute
the deadline, and one after wait_until_impl to check whether the
deadline was hit), any such imprecision that causes an extra iteration
will reach 5 and cause the test to fail.
Initializing the epoch in the beginning of the test makes such
spurious fails due to loss of precision far less likely. I don't
suppose allowing for an extra couple of calls would be desirable.
While at that, I'm annotating unused status variables as such.
for libstdc++-v3/ChangeLog
PR libstdc++/91486
* testsuite/30_threads/async/async.cc
(test_pr91486_wait_for): Mark status as unused.
(test_pr91486_wait_until): Likewise. Initialize epoch later.
Diffstat (limited to 'gcc/fold-const.cc')
0 files changed, 0 insertions, 0 deletions