public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60421] New: std::this_thread::sleep_for doesn't sleep for all arguments
@ 2014-03-05  9:19 jaak at ristioja dot ee
  2014-03-05 10:50 ` [Bug libstdc++/60421] " plasmahh at gmx dot net
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jaak at ristioja dot ee @ 2014-03-05  9:19 UTC (permalink / raw)
  To: gcc-bugs

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.
>From gcc-bugs-return-445449-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 05 09:24:08 2014
Return-Path: <gcc-bugs-return-445449-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27677 invoked by alias); 5 Mar 2014 09:24:08 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27633 invoked by uid 48); 5 Mar 2014 09:24:05 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/60422] New: <bits/xxx.h> headers should give a diagnostic when included directly
Date: Wed, 05 Mar 2014 09:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-60422-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg00318.txt.bz2
Content-length: 953

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`422

            Bug ID: 60422
           Summary: <bits/xxx.h> headers should give a diagnostic when
                    included directly
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

Some users do dumb things like:

#include <algorithm>
#include <ext/concurrence.h>
#include <bits/unique_ptr.h>
#include <bits/shared_ptr.h>

and expect to be able to use std::shared_ptr.  This happens to work with GCC
4.8, but not with 4.9 because we re-arranged some headers to allow the library
to use shared_ptr internally.

In order to stop this nonsense we should add preprocessor checks to the
headers:

#ifndef _MEMORY
#error Do not include this header directly, use <memory> instead
#else
...
#endif


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-27  0:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-05  9:19 [Bug libstdc++/60421] New: std::this_thread::sleep_for doesn't sleep for all arguments jaak at ristioja dot ee
2014-03-05 10:50 ` [Bug libstdc++/60421] " plasmahh at gmx dot net
2014-03-05 11:30 ` redi at gcc dot gnu.org
2014-09-19 10:30 ` redi at gcc dot gnu.org
2015-03-26 20:08 ` redi at gcc dot gnu.org
2015-03-26 20:14 ` redi at gcc dot gnu.org
2015-03-26 22:28 ` jaak at ristioja dot ee
2015-03-26 23:45 ` jaak at ristioja dot ee
2015-03-27  3:47 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).