From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DE98F3858C27; Thu, 27 Apr 2023 10:29:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE98F3858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682591395; bh=EXxCuD38tQmn1bvIhwjFKH5pwVVNFQ1bh3YRv3PjBYw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uA+p5ZIywus3vZHbMfqokVwSfx56O0RUELyRbvYhFYoNzkyg71uZWvYzJtZ7c1l+4 ne/9Qje8TDYuZLAlfjSdQ2//cll4Ea3a5ukjtcqzxSJ0keBagUxQ4/L0NefOJgKKAG AYY9/sup3szFVMjZ68GYSZXZ17Ds19avPqiMrBTY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/105081] Make std::random_device throw std::system_error Date: Thu, 27 Apr 2023 10:29:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105081 --- Comment #3 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:f9412cedd6c0e7417b30d9a80d3f45c8746223b4 commit r14-289-gf9412cedd6c0e7417b30d9a80d3f45c8746223b4 Author: Jonathan Wakely Date: Wed Apr 26 15:23:57 2023 +0100 libstdc++: Make std::random_device throw std::system_error [PR105081] This changes std::random_device constructors to throw std::system_error (with EINVAL as the error code) when the constructor argument is invalid. We can also throw std::system_error when read(2) fails so that the exception includes the additional information provided by errno. As noted in the PR, this is consistent with libc++, and doesn't break any existing code which catches std::runtime_error, because those handlers will still catch std::system_error. libstdc++-v3/ChangeLog: PR libstdc++/105081 * src/c++11/random.cc (__throw_syserr): New function. (random_device::_M_init, random_device::_M_init_pretr1): Use new function for bad tokens. (random_device::_M_getval): Use new function for read errors. * testsuite/util/testsuite_random.h (random_device_available): Change catch handler to use std::system_error.=