[PATCH ] PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>
Jonathan Wakely
jwakely@redhat.com
Tue Jul 29 08:30:00 GMT 2014
On 29/07/14 04:11 -0400, Ed Smith-Rowland wrote:
>As discussed in the audit trail both _Adaptor and generate_canonical
>are both meant to use floating point values. Both are here given
>static_asserts to that effect.
>This would have prevented this error and might help future users.
>
>The main issue is the use of value_type in _Adaptor and thus in
>generate_canonical in hypergeometric_distribution::operator(). This
>distribution is a discreet distribution and thus value_type is an
>unsigned integer which caused overflow in generate_canonical. In
>keeping with practice in all other discreet distributions a double
>type will now be used in _Adaptor.
>
>Someday, it might be beneficial to discuss an _IntegralAdaptor and a
>corresponding __generate_canonical for use in our discreet
>distributions but I want to close this bug with this patch.
Makes sense, thanks for the fix.
>Built and tested on x86_64-linux.
>
>OK?
One question ...
>Index: testsuite/ext/random/hypergeometric_distribution/pr60037.cc
>===================================================================
>--- testsuite/ext/random/hypergeometric_distribution/pr60037.cc (revision 0)
>+++ testsuite/ext/random/hypergeometric_distribution/pr60037.cc (working copy)
>@@ -0,0 +1,24 @@
>+// { dg-options "-std=gnu++11" }
>+// { dg-require-cstdint "" }
>+// { dg-require-cmath "" }
>+// { dg-options "-O0" }
Did you mean to have two separate dg-options directives here?
OK to commit, after either combining them into one or removing the
second one.
More information about the Libstdc++
mailing list