https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122293

            Bug ID: 122293
           Summary: [16 Regression][gcn,nvptx] Build fails with
                    bits/this_thread_sleep.h:71:40: error:
                    ‘__to_timeout_timespec’ is not a member of
                    ‘std::chrono’
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: mac at mcrowe dot com, redi at gcc dot gnu.org
  Target Milestone: ---
            Target: gcn,nvptx

GCC bootstrap for GCN and Nvptx fails with:

In file included from nvptx-none/libstdc++-v3/include/thread:48,
                 from repos/gcc/libstdc++-v3/src/c++11/thread.cc:29:
nvptx-none/libstdc++-v3/include/bits/this_thread_sleep.h: In function ‘void
std::this_thread::sleep_for(const std::chrono::duration<_Rep1, _Period1>&)’:
nvptx-none/libstdc++-v3/include/bits/this_thread_sleep.h:71:40: error:
‘__to_timeout_timespec’ is not a member of ‘std::chrono’ [-Wtemplate-body]
   71 |         struct timespec __ts = chrono::__to_timeout_timespec(__rtime);
      |                                        ^~~~~~~~~~~~~~~~~~~~~

* * *

I see in include/bits/chrono.h

#if defined _GLIBCXX_USE_NANOSLEEP || defined _GLIBCXX_USE_CLOCK_REALTIME \
    || defined _GLIBCXX_HAS_GTHREADS
namespace chrono
{
...
  template<typename _Rep, typename _Period>
    [[__nodiscard__]] _GLIBCXX14_CONSTEXPR inline
    struct ::timespec
    __to_timeout_timespec(const duration<_Rep, _Period>& __d)
    {

* * * 

I see in include/bits/this_thread_sleep.h

#ifndef _GLIBCXX_NO_SLEEP

    /// this_thread::sleep_for
    template<typename _Rep, typename _Period>
      inline void
      sleep_for(const chrono::duration<_Rep, _Period>& __rtime)
      {
        if (__rtime <= __rtime.zero())
          return;

        struct timespec __ts = chrono::__to_timeout_timespec(__rtime);
#ifdef _GLIBCXX_USE_NANOSLEEP
        while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
          { }
#else
        using chrono::seconds;
        using chrono::nanoseconds;
        void __sleep_for(seconds __s, nanoseconds __ns);
        __sleep_for(seconds(__ts.tv_sec), nanoseconds(__ts.tv_nsec));
#endif

* * *

config.h shows:

#define HAVE_SLEEP 1
#define HAVE_USLEEP 1
/* #undef _GLIBCXX_NO_SLEEP */
/* #undef _GLIBCXX_USE_NANOSLEEP */
/* #undef _GLIBCXX_USE_WIN32_SLEEP */
/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */
/* #undef _GLIBCXX_USE_CLOCK_MONOTONIC */
/* #undef _GLIBCXX_USE_CLOCK_REALTIME */
/* #undef _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT */
/* #undef _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK */
/* #undef _GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK */

Reply via email to