summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2013-06-11 23:02:09 +0200
committerSven Verdoolaege <skimo@kotnet.org>2013-06-11 23:02:09 +0200
commit76a5cc9179e76349c09eb3350a379b001ce02365 (patch)
treef5c6e91f8e15d902aae8c0637cdeec0b3dd267a5
parent43fff90f1d95d55832497e0ed797aee01fe8e54c (diff)
downloadisl-76a5cc9179e76349c09eb3350a379b001ce02365.tar.gz
isl-76a5cc9179e76349c09eb3350a379b001ce02365.tar.bz2
isl-76a5cc9179e76349c09eb3350a379b001ce02365.zip
isl_local_space_substitute_equalities: avoid writing to shared matrix
We only called isl_local_space_cow on the local space itself, but the div matrix could still be shared with other local spaces. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
-rw-r--r--isl_local_space.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/isl_local_space.c b/isl_local_space.c
index 6c4fb840..924b5ca1 100644
--- a/isl_local_space.c
+++ b/isl_local_space.c
@@ -718,7 +718,6 @@ __isl_give isl_local_space *isl_local_space_substitute_equalities(
unsigned total;
unsigned n_div;
- ls = isl_local_space_cow(ls);
if (!ls || !eq)
goto error;
@@ -736,6 +735,12 @@ __isl_give isl_local_space *isl_local_space_substitute_equalities(
for (k = 0; k < ls->div->n_row; ++k) {
if (isl_int_is_zero(ls->div->row[k][1 + j]))
continue;
+ ls = isl_local_space_cow(ls);
+ if (!ls)
+ goto error;
+ ls->div = isl_mat_cow(ls->div);
+ if (!ls->div)
+ goto error;
isl_seq_elim(ls->div->row[k] + 1, eq->eq[i], j, total,
&ls->div->row[k][0]);
normalize_div(ls, k);