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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:71e941b0e329d3a316e465569c92e08788a68614

commit r13-8771-g71e941b0e329d3a316e465569c92e08788a68614
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Mon Mar 18 13:22:17 2024 +0000

    libstdc++: Fix infinite loop in std::binomial_distribution [PR114359]

    The multiplication (4 * _M_t * __1p) can wraparound to zero if _M_t is
    unsigned and 4 * _M_t wraps to zero. The third operand has type double,
    so do the second multiplication first, so that we aren't multiplying
    integers.

    libstdc++-v3/ChangeLog:

            PR libstdc++/114359
            * include/bits/random.tcc (binomial_distribution::param_type):
            Ensure arithmetic is done as type double.
            * testsuite/26_numerics/random/binomial_distribution/114359.cc: New
test.

    (cherry picked from commit 07e03761a7fc1626a6a74ed957e117f56981558c)
  • [Bug libstdc++/114359] std::bin... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to