From: Sven Verdoolaege Date: Thu, 24 Apr 2014 09:04:13 +0000 (+0200) Subject: isl_map_union_disjoint: check spaces before handling special cases X-Git-Tag: isl-0.14~137 X-Git-Url: https://repo.or.cz/w/isl.git/commitdiff_plain/19ff2b8baa9b8a48e4389c0155c26281441db12a isl_map_union_disjoint: check spaces before handling special cases isl_map_union_disjoint checks for special cases such as inputs that are empty before verifying that the two inputs live in the same space. A result could therefore be produced even in some cases where the inputs are invalid. Check for equal spaces first and refuse to give a result if the input spaces do not match. Signed-off-by: Sven Verdoolaege --- diff --git a/isl_map.c b/isl_map.c index 9014b2ea..0bf21cfe 100644 --- a/isl_map.c +++ b/isl_map.c @@ -7104,6 +7104,10 @@ static __isl_give isl_map *map_union_disjoint(__isl_take isl_map *map1, if (!map1 || !map2) goto error; + if (!isl_space_is_equal(map1->dim, map2->dim)) + isl_die(isl_map_get_ctx(map1), isl_error_invalid, + "spaces don't match", goto error); + if (map1->n == 0) { isl_map_free(map1); return map2; @@ -7129,8 +7133,6 @@ static __isl_give isl_map *map_union_disjoint(__isl_take isl_map *map1, return map2; } - isl_assert(map1->ctx, isl_space_is_equal(map1->dim, map2->dim), goto error); - if (ISL_F_ISSET(map1, ISL_MAP_DISJOINT) && ISL_F_ISSET(map2, ISL_MAP_DISJOINT)) ISL_FL_SET(flags, ISL_MAP_DISJOINT);