This is the mail archive of the gcc-bugs@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]

[Bug libstdc++/60037] SIGFPE in std::generate_canonical<unsigned int...>


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60037

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |3dw4rd at verizon dot net

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
To further clarify, the problem is that hypergeometric_distribution is using:

    std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
      __aurng(__urng);

where result_type is an *integer* type, and that is not Ok, because _Adaptor
just forwards to generate_canonical, which wants a *floting point* type as
first template argument. I suspect that something as simple as:

    std::__detail::_Adaptor<_UniformRandomNumberGenerator, double>
      __aurng(__urng);

could be most of the fix (in a couple other places, for discrete distributions,
I ended up using _Adaptor exactly like that) but the implementor (ie, Ed) of
hypergeometric_distribution should really look into it.

Eventually, we should remember to add a static_assert to _Adaptor of the form:

       static_assert(std::is_floating_point<_DInputType>::value,
            "template argument not a floating point type");

Ed, can you please have a look?


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