[PPL-devel] [Bug Report] GMP and PPL mismatches

Roberto Bagnara bagnara at cs.unipr.it
Thu Jan 3 19:10:48 CET 2013


On 01/03/13 12:47, Chia-Hsun Cheng wrote:
> ------------
> Problem
> ------------
>      This is a problem I faced when building prerequisite libraries(gmp, mpfr, mpc, ppl, cloog)
>      before building gcc-4.7.2 from source today.
>      I found a mismatch between GMP and PPL when trying to compile the PPL library from source code.
>      (Building GMP alone is fine.)
> -------------------------------
> Source Code Version
> -------------------------------
>      The source code that I downloaded from are
>      a. GMP
>          Site:
> http://gmplib.org/#DOWNLOAD
> Download link:
> ftp://ftp.gmplib.org/pub/gmp-5.1.0/gmp-5.1.0.tar.bz2
> b. PPL(Parma Polyhedra Library)
> Site:
> http://bugseng.com/products/ppl/download
> Download link:
> http://bugseng.com/products/ppl/download/ftp/releases/1.0/ppl-1.0.tar.bz2
> -----------------------
> Problem Details
> -----------------------
>      1.  < Redefinition of numeric_limits >
>          ppl-1.0/src/mp_std_bits.defs.hh:47 and
> gmp-5.1.0/gmpxx.h:3269
> both define
> numeric_limits<mpz_class> and
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> numeric_limits<mpq_class>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>          Problem:
>          It would lead to a redefinition error when trying to compile PPL source code to object code.
>          It seems that the newer GMP library(5.1.0) has included the definition of numeric_limits but
> for PPL library, the definitions are not removed.
>          I googled this problem. There are also some reports to this problem.
>
> Fix:
> I commented out the numeric_limits defined in ppl-1.0/src/mp_std_bits.defs.hh.
>      2.  < Static data member name mismatches >
>           ppl-1.0/src/mp_std_bits.defs.hh:72 and ppl-1.0/src/mp_std_bits.defs.hh:133 defines
>   static const bool tininess_before = false;
>                                    ^^^^^^^^^^^^^^^^^
>           However, in
>           gmp-5.1.0/gmpxx.h:3302 and gmp-5.1.0/gmpxx.h:3339, there are
>   static const bool tinyness_before = false;
>                   ^^^^^^^^^^^^^^^^^^
>   Problem:
>   I am not sure if the two data member are the same. Since I commented out the whole block of
>   numeric_limits in ppl-1.0/src/mp_std_bits.defs.hh in the last step, the member `tininess_before'
>   cannot be resolved.
>   Fix:
>   Finally, I add
>   static const bool tininess_before = false;
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   in gmp-5.1.0/gmpxx.h:3303 and gmp-5.1.0/gmpxx.h:3341
>   and add member initialization
>   const bool numeric_limits<T>::tininess_before; \
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   in gmp-5.1.0/cxx/limits.cc:47
>   and rebuild the gmp library.
>   So, for PPL library, even if the code for numeric_limits is commented out, the declarations and object
>   code can be found from GMP library.
> ----------------
> Conclusion
> ----------------
>      GMP and PPL libraries can be compiled. I am running the PPL 'make check' test now.
>      I am not sure whether it is a bug so I decided to report the issue to both sides. Hope that
>      the mismatch can be fixed, thanks!
> ---------------------
> Attached Files
> ---------------------
>      The mismatches are not related to configuration, so I skipped 'config.log'. If needed, please reply to me.
>      gcc-v.log                          : GCC version
>      uname-a.log                     : Info of environment
>      diff_gmpxx.h.txt                : Modification of gmp-5.1.0/gmpxx.h
>      diff_mp_std_bits.defs.hh   : Modification of ppl-1.0/src/mp_std_bits.defs.hh
>      diff_limits.cc.txt                : Modification of gmp-5.1.0/cxx/limits.cc
> Best Regards
> -- chiahsun


Hello Chia-Hsun,

thanks for the report.  Indeed, previous versions of GMP did not
define std::numeric_limits for its data types.  That is why we were
defining these specializations ourselves.  Immediately after the
release of GMP 5.1.0 we made that code conditional on the version of
GMP.  Both the Git version of the PPL and the snapshot of PPL 1.1
available at

    http://bugseng.com/products/ppl/download/ftp/snapshots/

contain the correction.
Kind regards,

     Roberto

-- 
      Prof. Roberto Bagnara

Applied Formal Methods Laboratory - University of Parma, Italy
mailto:bagnara at cs.unipr.it
                               BUGSENG srl - http://bugseng.com
                               mailto:roberto.bagnara at bugseng.com


More information about the gmp-bugs mailing list