[Bug libstdc++/60421] New: std::this_thread::sleep_for doesn't sleep for all arguments

jaak at ristioja dot ee gcc-bugzilla@gcc.gnu.org
Wed Mar 5 09:19:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60421

            Bug ID: 60421
           Summary: std::this_thread::sleep_for doesn't sleep for all
                    arguments
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jaak at ristioja dot ee

#include <chrono>
  #include <limits>
  #include <thread>
  int main() {
   
std::this_thread::sleep_for(std::chrono::duration<uint64_t>(std::numeric_limits<uint64_t>::max()));
    return 0;
  }

This doesn't even sleep a millisecond. Relevant strace output:

  nanosleep({18446744073709551615, 0}, NULL) = -1 EINVAL (Invalid argument)

Hence the §30.3.2.7 of the C++11 standard is violated as sleep_for does not
sleep by the relative amount of time specified by its argument. Bug may be run
into during testing.

Also happens with 4.7.3.


More information about the Gcc-bugs mailing list