[PPL-devel] [GIT] ppl/ppl(master): Corrected a bug affecting Interval:: CC76_widening_assign(const From&, Iterator, Iterator).
Roberto Bagnara
bagnara at cs.unipr.it
Fri Aug 13 15:39:39 CEST 2010
Module: ppl/ppl
Branch: master
Commit: 535657baab7b4f5e6d884a7fcdc2138b1ea0797c
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=535657baab7b4f5e6d884a7fcdc2138b1ea0797c
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Fri Aug 13 15:37:24 2010 +0200
Corrected a bug affecting Interval::CC76_widening_assign(const From&, Iterator, Iterator).
This, in turn, affected Box::CC76_widening_assign(const T&, Iterator,
Iterator): lower bound would not be computed correctly when the two
iterators specify an empty list of stop points. Many thanks to Sagar
Chaki and Arie Gurfinkel.
---
NEWS | 16 ++++++++++++++++
src/Interval.templates.hh | 8 ++++++--
tests/Box/cc76widening.cc | 33 +++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index d9508f0..67c19e2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,22 @@ Parma Polyhedra Library NEWS -- history of user-visible changes
--------------------------------------------------------------------------
+NEWS for version 0.11 (release date to be decided)
+--------------------------------------------------------------------------
+
+Bugfixes
+========
+
+o Corrected a bug affecting methods
+
+ Box::CC76_widening_assign(const T&, Iterator, Iterator)
+ Interval::CC76_widening_assign(const From&, Iterator, Iterator)
+
+ whereby a lower bound would not be computed correctly when the two
+ iterators specify an empty list of stop points.
+
+
+--------------------------------------------------------------------------
NEWS for version 0.11 (released on August 2, 2010)
--------------------------------------------------------------------------
diff --git a/src/Interval.templates.hh b/src/Interval.templates.hh
index 456458e..eedd48e 100644
--- a/src/Interval.templates.hh
+++ b/src/Interval.templates.hh
@@ -120,8 +120,12 @@ Interval<Boundary, Info>::CC76_widening_assign(const From& y,
x.lower_extend();
}
}
- else
- x_lb = *--k;
+ else {
+ if (k != first)
+ x_lb = *--k;
+ else
+ x.lower_extend();
+ }
}
}
}
diff --git a/tests/Box/cc76widening.cc b/tests/Box/cc76widening.cc
index 0c7eccf..44a6ce0 100644
--- a/tests/Box/cc76widening.cc
+++ b/tests/Box/cc76widening.cc
@@ -78,9 +78,42 @@ test02() {
return ok;
}
+bool
+test03() {
+ typedef TBox::interval_type::boundary_type tbt;
+ // No stop point indeed.
+ tbt stop_points;
+
+ Variable x(0);
+ Variable y(1);
+
+ TBox box1(2);
+ box1.add_constraint(x >= 1);
+ box1.add_constraint(x <= 4);
+
+ TBox box2(2);
+ box2.add_constraint(x >= 3);
+ box2.add_constraint(x <= 4);
+
+ print_constraints(box1, "*** box1 ***");
+ print_constraints(box2, "*** box2 ***");
+
+ box1.CC76_widening_assign(box2, &stop_points, &stop_points);
+
+ Rational_Box known_result(2);
+ known_result.add_constraint(x <= 4);
+
+ bool ok = check_result(box1, known_result);
+
+ print_constraints(box1, "*** box1.CC76_widening_assign(box2) ***");
+
+ return ok;
+}
+
} // namespace
BEGIN_MAIN
DO_TEST(test01);
DO_TEST(test02);
+ DO_TEST(test03);
END_MAIN
More information about the PPL-devel
mailing list