From 7b2f4c9f0cf2facd9696aa3b7842ad695b5dadcd Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 21 Apr 2015 14:34:05 +0200 Subject: [PATCH] isl_coalesce.c: contains: improve error handling Signed-off-by: Sven Verdoolaege --- isl_coalesce.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/isl_coalesce.c b/isl_coalesce.c index 57d28efe..0c26cf08 100644 --- a/isl_coalesce.c +++ b/isl_coalesce.c @@ -521,9 +521,13 @@ static int contains(struct isl_coalesce_info *info, struct isl_tab *tab) isl_seq_neg(bmap->eq[k], bmap->eq[k], 1 + dim); stat = status_in(bmap->eq[k], tab); isl_seq_neg(bmap->eq[k], bmap->eq[k], 1 + dim); + if (stat < 0) + return -1; if (stat != STATUS_VALID) return 0; stat = status_in(bmap->eq[k], tab); + if (stat < 0) + return -1; if (stat != STATUS_VALID) return 0; } @@ -533,6 +537,8 @@ static int contains(struct isl_coalesce_info *info, struct isl_tab *tab) if (info->ineq[k] == STATUS_REDUNDANT) continue; stat = status_in(bmap->ineq[k], tab); + if (stat < 0) + return -1; if (stat != STATUS_VALID) return 0; } @@ -584,6 +590,7 @@ static enum isl_change is_adj_ineq_extension(int i, int j, unsigned n_eq = info[i].bmap->n_eq; unsigned total = isl_basic_map_total_dim(info[i].bmap); int r; + int super; if (isl_tab_extend_cons(info[i].tab, 1 + info[j].bmap->n_ineq) < 0) return isl_change_error; @@ -616,7 +623,10 @@ static enum isl_change is_adj_ineq_extension(int i, int j, return isl_change_error; } - if (contains(&info[j], info[i].tab)) + super = contains(&info[j], info[i].tab); + if (super < 0) + return isl_change_error; + if (super) return fuse(i, j, info, NULL, 0, 0); if (isl_tab_rollback(info[i].tab, snap) < 0) @@ -727,6 +737,8 @@ static enum isl_change is_adj_eq_extension(int i, int j, int k, if (isl_tab_select_facet(info[i].tab, n_eq + k) < 0) return isl_change_error; super = contains(&info[j], info[i].tab); + if (super < 0) + return isl_change_error; if (super) { int l; unsigned total; -- 2.11.4.GIT