This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH ] PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>


On 07/29/2014 04:29 AM, Jonathan Wakely wrote:
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.

Committed (with small changes to test cases).
Attached new CLand patch.

Attachment: CL_pr60037
Description: Text document

Attachment: patch_pr60037_2
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]