isl_aff_gist: add missing isl_vec_cow
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 12 Nov 2012 11:13:15 +0000 (12:13 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 12 Nov 2012 11:15:34 +0000 (12:15 +0100)
We could end up modifying a different isl_aff that originated from
the same isl_aff as the one being modified.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_aff.c

index 372afb6..79fd8d5 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -1276,7 +1276,8 @@ static __isl_give isl_aff *isl_aff_substitute_equalities_lifted(
 
        aff->ls = isl_local_space_substitute_equalities(aff->ls,
                                                        isl_basic_set_copy(eq));
-       if (!aff->ls)
+       aff->v = isl_vec_cow(aff->v);
+       if (!aff->ls || !aff->v)
                goto error;
 
        total = 1 + isl_space_dim(eq->dim, isl_dim_all);