]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Make std::random_device throw more std::system_error [PR105081]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 30 Jun 2023 13:37:59 +0000 (14:37 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 30 Jun 2023 14:09:17 +0000 (15:09 +0100)
commitd6a6a4ea086d6af97bd7fbd482f51df41c265b79
tree8d9e1c491c529bccc7a813d48c5930ec858cda7c
parentca15abc0ff7cb5e821a8c1d69e9b37416d5390c5
libstdc++: Make std::random_device throw more std::system_error [PR105081]

In r14-289-gf9412cedd6c0e7 I made the std::random_device constructor
throw std::system_error for unrecognized tokens. But it still throws
std::runtime_error for a token such as "rdseed" that is recognized but
not supported at runtime by the CPU the program is running on.

With this change we throw std::system_error for those cases too. This
fixes the following failures on Intel CPUs withour rdseed support:

FAIL: 26_numerics/random/random_device/94087.cc execution test
FAIL: 26_numerics/random/random_device/cons/token.cc execution test
FAIL: 26_numerics/random/random_device/entropy.cc execution test

libstdc++-v3/ChangeLog:

PR libstdc++/105081
* src/c++11/random.cc (random_device::_M_init): Throw
std::system_error when the requested device is a valid token but
not available at runtime.
libstdc++-v3/src/c++11/random.cc