[Boost-bugs] [Boost C++ Libraries] #8423: miller_rabin_test core dump

Subject: [Boost-bugs] [Boost C++ Libraries] #8423: miller_rabin_test core dump
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-10 07:09:21


#8423: miller_rabin_test core dump
------------------------------------+---------------------------------------
 Reporter: robbieye@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: miller rabin primality |
------------------------------------+---------------------------------------
 When running the following code in Ubuntu 12.04 (gcc 4.6) with Boost
 1.53.0, the program had a core-dump in miller_rabin_test().

 The program was doing primality test on 2^(2^5) + 1 when it crashed.
 Values such as 2^(2^4) + 1 or 2^(2^6) + 1 do not cause such problems.

 Thanks in advance for looking into it.

 -Rob

 ------------------------------------------------------
 #include <iostream>

 #include <boost/multiprecision/cpp_int.hpp>
 #include <boost/multiprecision/miller_rabin.hpp>
 #include <boost/multiprecision/random.hpp>

 namespace mp = boost::multiprecision;

 typedef mp::cpp_int BIGNUM;

 int
 main(int argc, char* argv[])
 {
     // Test primality of 2^(2^5) + 1
     BIGNUM num = (BIGNUM(1) << (1u << 5)) + 1;
     boost::random::mt19937 prng(clock());

     std::cout << "Running primality test for : " << num;
     bool isPrime = mp::miller_rabin_test(num, 25, prng);

     std::cout << ", result : "
               << (isPrime ? "" : "not ")
               << "prime."
               << std::endl;

     return 0;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8423>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC