[Bug Report] GMP and PPL mismatches

Chia-Hsun Cheng chiahsun0814 at gmail.com
Thu Jan 3 12:47:04 CET 2013


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
-------------- next part --------------
--- gmpxx.h	2013-01-03 16:42:40.791544069 +0800
+++ ../gmp-5.1.0-unmodified/gmp-5.1.0/gmpxx.h	2012-12-19 03:05:09.000000000 +0800
@@ -3300,7 +3300,6 @@
     static const bool is_modulo = false;
     static const bool traps = false;
     static const bool tinyness_before = false;
-    static const bool tininess_before = false;
     static const float_round_style round_style = round_toward_zero;
   };
 
@@ -3338,7 +3337,6 @@
     static const bool is_modulo = false;
     static const bool traps = false;
     static const bool tinyness_before = false;
-    static const bool tininess_before = false;
     static const float_round_style round_style = round_toward_zero;
   };
 
@@ -3376,7 +3374,6 @@
     static const bool is_modulo = false;
     static const bool traps = false;
     static const bool tinyness_before = false;
-    static const bool tininess_before = false;
     static const float_round_style round_style = round_indeterminate;
   };
 }
-------------- next part --------------
--- ./cxx/limits.cc	2013-01-03 16:29:41.772521181 +0800
+++ ../gmp-5.1.0-unmodified/gmp-5.1.0/cxx/limits.cc	2012-12-19 03:05:09.000000000 +0800
@@ -43,7 +43,6 @@
   const bool numeric_limits<T>::is_modulo; \
   const bool numeric_limits<T>::traps; \
   const bool numeric_limits<T>::tinyness_before; \
-  const bool numeric_limits<T>::tininess_before; \
   const float_round_style numeric_limits<T>::round_style
 
   GMPXX_INSTANTIATE_LIMITS(mpz_class);
-------------- next part --------------
--- ./src/mp_std_bits.defs.hh	2013-01-03 18:35:45.774546010 +0800
+++ ../ppl-1.0-unmodified/ppl-1.0/src/mp_std_bits.defs.hh	2012-06-28 18:50:33.000000000 +0800
@@ -43,8 +43,6 @@
 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
 //! Specialization of std::numeric_limits.
 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
-
-/*	
 template <>
 class numeric_limits<mpz_class> {
 private:
@@ -163,7 +161,6 @@
     return static_cast<Type>(0);
   }
 };
-*/
 
 } // namespace std
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-v.log
Type: application/octet-stream
Size: 819 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20130103/2c015920/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uname-a.log
Type: application/octet-stream
Size: 118 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20130103/2c015920/attachment-0001.obj>


More information about the gmp-bugs mailing list