https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:31a5cc60428b968c9ff3f505fcd1a5ef5c0083bb commit r9-9369-g31a5cc60428b968c9ff3f505fcd1a5ef5c0083bb Author: Jonathan Wakely <jwak...@redhat.com> Date: Thu Oct 8 15:14:58 2020 +0100 libstdc++: Add assertions for preconditions in sampling distributions [PR 82584] These three distributions all require 0 < S where S is the sum of the weights. When the sum is zero there's an undefined FP division by zero. Add assertions to help users diagnose the problem. libstdc++-v3/ChangeLog: PR libstdc++/82584 * include/bits/random.tcc (discrete_distribution::param_type::_M_initialize) (piecewise_constant_distribution::param_type::_M_initialize) (piecewise_linear_distribution::param_type::_M_initialize): Add assertions for positive sums.. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error line. (cherry picked from commit b2a96bf9dce41ee777b1669e4a8b4c6df3ff3613)