public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94087] New: std::random_device often fails when used from multiple threads
@ 2020-03-08  2:51 coryan+gccbugzilla at google dot com
  2020-03-08  7:51 ` [Bug target/94087] " pinskia at gcc dot gnu.org
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: coryan+gccbugzilla at google dot com @ 2020-03-08  2:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94087
           Summary: std::random_device often fails when used from multiple
                    threads
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: coryan+gccbugzilla at google dot com
  Target Milestone: ---

Created attachment 47995
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47995&action=edit
A program to reproduce the problem.

Creating and using a `std::random_device` object fails when used from multiple
threads. A `std::exception` exception is throw with the message "random_device:
rdseed failed", probably from this point in the code:

https://github.com/gcc-mirror/gcc/blob/2a4c59d9aa6b1018fa8f86dd8c0573c1fed3f199/libstdc%2B%2B-v3/src/c%2B%2B11/random.cc#L108

The problem is easy to reproduce, compile the attached program and run it, it
fails every time.  I guess any version where __GLIBCXX__ >= 20200128 would have
this problem.

I just compiled with:

g++ -std=c++17 -pthread -o /tmp/repro-rdseed repro-rdseed.cc

and then run the program using:

/tmp/repro-rdseed

The program exits with 0 on success, 1 on failure, and prints some explanatory
messages (and some version numbers). 


The bug *is* present on openSUSE/Tumbleweed, where the compiler reports:

g++ (SUSE Linux) 9.2.1 20200128 [revision
83f65674e78d97d27537361de1a9d74067ff228d]
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.




The bug is *not* present on on Fedora:31 where the compiler reports:

g++ (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.





PS: Apologies if I get my version numbers wrong, I am used to using binary
distributions, have not compiled GCC from source in 2 decades or so.

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

end of thread, other threads:[~2020-07-09  9:14 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-08  2:51 [Bug libstdc++/94087] New: std::random_device often fails when used from multiple threads coryan+gccbugzilla at google dot com
2020-03-08  7:51 ` [Bug target/94087] " pinskia at gcc dot gnu.org
2020-03-08  7:51 ` pinskia at gcc dot gnu.org
2020-03-08  8:08 ` pinskia at gcc dot gnu.org
2020-03-08 12:04 ` coryan+gccbugzilla at google dot com
2020-03-08 12:09 ` coryan+gccbugzilla at google dot com
2020-03-09  9:44 ` redi at gcc dot gnu.org
2020-03-09 12:10 ` coryan+gccbugzilla at google dot com
2020-03-09 12:24 ` redi at gcc dot gnu.org
2020-04-23  3:30 ` wnereiz at kawashiro dot org
2020-05-14 10:27 ` rguenth at gcc dot gnu.org
2020-05-14 10:30 ` rguenth at gcc dot gnu.org
2020-05-14 10:44 ` redi at gcc dot gnu.org
2020-05-14 10:51 ` redi at gcc dot gnu.org
2020-05-14 11:35 ` redi at gcc dot gnu.org
2020-05-14 11:35 ` hjl.tools at gmail dot com
2020-05-14 11:37 ` rguenther at suse dot de
2020-05-14 11:38 ` rguenther at suse dot de
2020-05-14 11:41 ` rguenther at suse dot de
2020-05-14 11:46 ` redi at gcc dot gnu.org
2020-05-14 11:51 ` rguenther at suse dot de
2020-05-14 12:01 ` redi at gcc dot gnu.org
2020-05-14 12:02 ` redi at gcc dot gnu.org
2020-05-14 12:05 ` redi at gcc dot gnu.org
2020-05-19 22:23 ` cvs-commit at gcc dot gnu.org
2020-05-23  8:18 ` redi at gcc dot gnu.org
2020-07-09  8:49 ` avi@cloudius-systems.com
2020-07-09  9:14 ` cvs-commit at gcc dot gnu.org
2020-07-09  9:14 ` 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).