[Bug Report] GMP and PPL mismatches

Dear all,
------------ 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

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

On 01/03/13 12:47, Chia-Hsun Cheng wrote:
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.
Dear Chia-Hsun,
Marco Bodrato (thanks Marco!) made me notice I overlooked this part of your message. Indeed this is a bug in the PPL: the right spelling is `tinyness_before' as correctly written in GMP. I have just fixed the Git version of the PPL and a new PPL 1.1 snapshot release will soon be added to the location I already indicated. Kind regards,
Roberto
participants (2)
-
Chia-Hsun Cheng
-
Roberto Bagnara