Opened 5 years ago

Closed 5 years ago

#13124 closed Bugs (fixed)

Boost Multiprecision: Compilation error on MSVC2017 with MPIR 3.0.0

Reported by: Porama Ruengrairatanaroj <seal.corner@…> Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.64.0 Severity: Showstopper
Keywords: Cc:

Description

I'm getting the following compilation error when attempting to use MPIR 3.0.0 as backend for Boost Multiprecision:

C:\dev\boost\boost\multiprecision\gmp.hpp(1008): error C2664: 'double __gmpf_get_d_2exp(long *,mpf_srcptr)': cannot convert argument 1 from 'mpir_si *' to 'long *' 
    C:\dev\boost\boost/multiprecision/gmp.hpp(1008): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

I've also confirmed that this issue doesn't happen on the previous MPIR release (2.7.2).

At the moment, changing the version guard here:

template <unsigned Digits10>
inline void eval_frexp(gmp_float<Digits10>& result, const gmp_float<Digits10>& val, long* e)
{
#if BOOST_MP_MPIR_VERSION >= 20600
   mpir_si v;
   mpf_get_d_2exp(&v, val.data());
   *e = v;
   eval_ldexp(result, val, -v);
#else
   mpf_get_d_2exp(e, val.data());
   eval_ldexp(result, val, -*e);
#endif
}

to:

#if BOOST_MP_MPIR_VERSION >= 20600 && BOOST_MP_MPIR_VERSION < 30000

eliminates the error, though I don't know enough about this to determine whether more changes will be needed (like the similar looking guard in the int* overload of this function).

The issue also occurs in Boost v1.65 beta 1, so I assume it hasn't been fixed yet. I'm guessing this is a consequence of the fix from https://svn.boost.org/trac10/ticket/12234.

I just used gmp_snips.cpp from the Boost examples to reproduce this, so I won't attach the code here.

For reference: all of the stated tests and the MPIR sources were compiled on MSVC2017 (x64, Debug), but I doubt that would change anything.

Change History (1)

comment:1 by John Maddock, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.