From 5702ce441a37f24b60c24de6b3fd9e06708ef4ea Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 20 Feb 2015 10:33:35 +0100 Subject: [PATCH] isl_basic_set_drop_constraint: add missing isl_basic_set_cow Reported-by: Sven Wuytack Signed-off-by: Sven Verdoolaege --- isl_constraint.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/isl_constraint.c b/isl_constraint.c index 049175ba..3f7976b2 100644 --- a/isl_constraint.c +++ b/isl_constraint.c @@ -674,6 +674,10 @@ __isl_give isl_constraint *isl_constraint_set_coefficient_si( * may be holding on to other constraints from the same bset. * This should be cleaned up when the internal representation of * isl_constraint is changed to use isl_aff. + * + * We manually set ISL_BASIC_SET_FINAL instead of calling + * isl_basic_set_finalize because this function is called by CLooG, + * which does not expect any variables to disappear. */ __isl_give isl_basic_set *isl_basic_set_drop_constraint( __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint) @@ -698,6 +702,10 @@ __isl_give isl_basic_set *isl_basic_set_drop_constraint( return bset; } + bset = isl_basic_set_cow(bset); + if (!bset) + goto error; + if (isl_constraint_is_equality(constraint)) { n = bset->n_eq; row = bset->eq; @@ -712,6 +720,7 @@ __isl_give isl_basic_set *isl_basic_set_drop_constraint( isl_seq_clr(row[i], 1 + total); isl_constraint_free(constraint); + ISL_F_SET(bset, ISL_BASIC_SET_FINAL); return bset; error: isl_constraint_free(constraint); -- 2.11.4.GIT