[PPL-devel] [GIT] ppl/ppl(termination): Corrected an invalid reference bug in PIP_Solution_Node::update_tableau().

Enea Zaffanella zaffanella at cs.unipr.it
Mon Mar 8 10:44:16 CET 2010


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sun Mar  7 11:36:11 2010 +0100

Corrected an invalid reference bug in PIP_Solution_Node::update_tableau().
The addition of tableau rows invalidates previously computed references.
Thanks to Marco Poletti for reporting this.

---

 src/PIP_Tree.cc |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index d970067..79d254e 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -1644,8 +1644,10 @@ PIP_Solution_Node::update_tableau(const PIP_Problem& pip,
           // This might be faster however.
           tableau.s.add_zero_rows(1, Row::Flags());
           tableau.t.add_zero_rows(1, Row::Flags());
-          neg_assign_row(tableau.s[1 + row_id], v_row);
-          neg_assign_row(tableau.t[1 + row_id], p_row);
+          // NOTE: addition of rows invalidates references v_row and p_row
+          // due to possible matrix reallocations: recompute them.
+          neg_assign_row(tableau.s[1 + row_id], tableau.s[row_id]);
+          neg_assign_row(tableau.t[1 + row_id], tableau.t[row_id]);
           sign.push_back(row_sign(tableau.t[1 + row_id], big_dimension));
           special_equality_row = mapping.size();
           basis.push_back(false);




More information about the PPL-devel mailing list