From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23140 invoked by alias); 27 Jul 2014 14:58:40 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23071 invoked by uid 48); 27 Jul 2014 14:58:34 -0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/60037] SIGFPE in std::generate_canonical Date: Sun, 27 Jul 2014 14:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: paolo.carlini at oracle dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg01764.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60037 Paolo Carlini changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |3dw4rd at verizon dot net --- Comment #8 from Paolo Carlini --- 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?