[PPL-devel] [GIT] ppl/ppl(master): Fixed bugs whereby the wrong types were used so that overflows were possible .

Roberto Bagnara bagnara at cs.unipr.it
Sun Oct 30 09:06:00 CET 2011


Module: ppl/ppl
Branch: master
Commit: bee06c610540c66c494829d89a9d3fb69db77723
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=bee06c610540c66c494829d89a9d3fb69db77723

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sun Oct 30 10:03:01 2011 +0100

Fixed bugs whereby the wrong types were used so that overflows were possible.
Detected by ECLAIR service utypflag.

---

 src/Checked_Number.templates.hh |    2 +-
 src/Congruence.cc               |    4 ++--
 src/checked.cc                  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Checked_Number.templates.hh b/src/Checked_Number.templates.hh
index 844e656..1f13f52 100644
--- a/src/Checked_Number.templates.hh
+++ b/src/Checked_Number.templates.hh
@@ -138,7 +138,7 @@ ascii_load(std::istream& s, T& t) {
     // ... then read and discard pretty printed value.
     if (!(s >> str))
       return false;
-    const unsigned sz = str.size();
+    const std::string::size_type sz = str.size();
     return sz > 2 && str[0] == '(' && str[sz-1] == ')';
   }
 }
diff --git a/src/Congruence.cc b/src/Congruence.cc
index 2a5d295..3cec37a 100644
--- a/src/Congruence.cc
+++ b/src/Congruence.cc
@@ -184,7 +184,7 @@ PPL::Congruence::is_tautological() const {
   if ((is_equality() && inhomogeneous_term() == 0)
       || (is_proper_congruence()
 	  && (inhomogeneous_term() % modulus() == 0))) {
-    for (unsigned i = space_dimension(); i > 0; --i)
+    for (dimension_type i = space_dimension(); i > 0; --i)
       if ((*this)[i] != 0)
 	return false;
     return true;
@@ -198,7 +198,7 @@ PPL::Congruence::is_inconsistent() const {
       || (is_proper_congruence()
 	  && ((inhomogeneous_term() % modulus()) == 0)))
     return false;
-  for (unsigned i = space_dimension(); i > 0; --i)
+  for (dimension_type i = space_dimension(); i > 0; --i)
     if ((*this)[i] != 0)
       return false;
   return true;
diff --git a/src/checked.cc b/src/checked.cc
index cc5a106..f4562b0 100644
--- a/src/checked.cc
+++ b/src/checked.cc
@@ -272,7 +272,7 @@ parse_number_part(std::istream& is, number_struct& num) {
   {
   ok:
     is.unget();
-    unsigned int n = num.mantissa.size();
+    std::string::size_type n = num.mantissa.size();
     while (n > 0 && num.mantissa[n - 1] == '0') {
       --n;
       ++exponent_offset;




More information about the PPL-devel mailing list