public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> @ 2020-10-08 14:06 ` redi at gcc dot gnu.org 2020-10-08 14:22 ` redi at gcc dot gnu.org ` (6 subsequent siblings) 7 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2020-10-08 14:06 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2020-10-08 Status|UNCONFIRMED |NEW ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> 2020-10-08 14:06 ` [Bug libstdc++/82584] div by zero in random distribution redi at gcc dot gnu.org @ 2020-10-08 14:22 ` redi at gcc dot gnu.org 2020-10-08 14:41 ` cvs-commit at gcc dot gnu.org ` (5 subsequent siblings) 7 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2020-10-08 14:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is user error. [rand.dist.samp.discrete] p2 says: > Moreover, the following relation shall hold: 0 < S = w0 + · · · + wn−1 . So there must be at least one non-zero weight. I'll add an assertion. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> 2020-10-08 14:06 ` [Bug libstdc++/82584] div by zero in random distribution redi at gcc dot gnu.org 2020-10-08 14:22 ` redi at gcc dot gnu.org @ 2020-10-08 14:41 ` cvs-commit at gcc dot gnu.org 2020-10-08 14:42 ` redi at gcc dot gnu.org ` (4 subsequent siblings) 7 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2020-10-08 14:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:b2a96bf9dce41ee777b1669e4a8b4c6df3ff3613 commit r11-3731-gb2a96bf9dce41ee777b1669e4a8b4c6df3ff3613 Author: Jonathan Wakely <jwakely@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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> ` (2 preceding siblings ...) 2020-10-08 14:41 ` cvs-commit at gcc dot gnu.org @ 2020-10-08 14:42 ` redi at gcc dot gnu.org 2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org ` (3 subsequent siblings) 7 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2020-10-08 14:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |11.0 Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- $ g++11 rando.cc -D_GLIBCXX_ASSERTIONS $ ./a.out /home/jwakely/gcc/11/include/c++/11.0.0/bits/random.tcc:2633: void std::discrete_distribution<_IntType>::param_type::_M_initialize() [with _IntType = int]: Assertion '__sum > 0' failed. Aborted (core dumped) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> ` (3 preceding siblings ...) 2020-10-08 14:42 ` redi at gcc dot gnu.org @ 2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org 2021-03-29 20:03 ` redi at gcc dot gnu.org ` (2 subsequent siblings) 7 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2021-03-29 20:01 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 --- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:56b810af1bdf106b132dcf1f1a01573af6a3468b commit r10-9572-g56b810af1bdf106b132dcf1f1a01573af6a3468b Author: Jonathan Wakely <jwakely@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) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> ` (4 preceding siblings ...) 2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org @ 2021-03-29 20:03 ` redi at gcc dot gnu.org 2021-04-20 18:52 ` cvs-commit at gcc dot gnu.org 2021-04-20 18:53 ` redi at gcc dot gnu.org 7 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2021-03-29 20:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|11.0 |10.3 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> ` (5 preceding siblings ...) 2021-03-29 20:03 ` redi at gcc dot gnu.org @ 2021-04-20 18:52 ` cvs-commit at gcc dot gnu.org 2021-04-20 18:53 ` redi at gcc dot gnu.org 7 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2021-04-20 18:52 UTC (permalink / raw) To: gcc-bugs 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 <redi@gcc.gnu.org>: https://gcc.gnu.org/g:31a5cc60428b968c9ff3f505fcd1a5ef5c0083bb commit r9-9369-g31a5cc60428b968c9ff3f505fcd1a5ef5c0083bb Author: Jonathan Wakely <jwakely@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) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/82584] div by zero in random distribution [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> ` (6 preceding siblings ...) 2021-04-20 18:52 ` cvs-commit at gcc dot gnu.org @ 2021-04-20 18:53 ` redi at gcc dot gnu.org 7 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2021-04-20 18:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82584 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|10.3 |9.4 --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- Fixed for 9.4 and 10.3 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-04-20 18:53 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-82584-4@http.gcc.gnu.org/bugzilla/> 2020-10-08 14:06 ` [Bug libstdc++/82584] div by zero in random distribution redi at gcc dot gnu.org 2020-10-08 14:22 ` redi at gcc dot gnu.org 2020-10-08 14:41 ` cvs-commit at gcc dot gnu.org 2020-10-08 14:42 ` redi at gcc dot gnu.org 2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org 2021-03-29 20:03 ` redi at gcc dot gnu.org 2021-04-20 18:52 ` cvs-commit at gcc dot gnu.org 2021-04-20 18:53 ` 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).