From 58a0493a4fda22124bb6934199c493765406b223 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 23 Jul 2010 13:51:33 +0200 Subject: [PATCH] fix isl_map_lex_ge and isl_map_lex_le in the zero-dimensional case The first zero dimensions are always equal, so these functions should return a universe map in the zero-dimensional case rather than an empty map. Signed-off-by: Sven Verdoolaege --- isl_map.c | 6 ++++++ isl_test.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/isl_map.c b/isl_map.c index 62eb108..5a38cd5 100644 --- a/isl_map.c +++ b/isl_map.c @@ -3016,6 +3016,9 @@ static __isl_give isl_map *map_lex_lte_first(__isl_take isl_dim *dims, struct isl_map *map; int i; + if (n == 0 && equal) + return isl_map_universe(dims); + map = isl_map_alloc_dim(isl_dim_copy(dims), n, ISL_MAP_DISJOINT); for (i = 0; i + 1 < n; ++i) @@ -3067,6 +3070,9 @@ static __isl_give isl_map *map_lex_gte_first(__isl_take isl_dim *dims, struct isl_map *map; int i; + if (n == 0 && equal) + return isl_map_universe(dims); + map = isl_map_alloc_dim(isl_dim_copy(dims), n, ISL_MAP_DISJOINT); for (i = 0; i + 1 < n; ++i) diff --git a/isl_test.c b/isl_test.c index 5b7a9ea..68b9fb3 100644 --- a/isl_test.c +++ b/isl_test.c @@ -1034,6 +1034,18 @@ void test_closure(struct isl_ctx *ctx) isl_map_free(map2); } +void test_lex(struct isl_ctx *ctx) +{ + isl_dim *dim; + isl_map *map; + + dim = isl_dim_alloc(ctx, 0, 0, 0); + map = isl_map_lex_le(dim); + isl_map_print(map, stderr, 0, 0); fprintf(stderr, "\n"); + assert(!isl_map_is_empty(map)); + isl_map_free(map); +} + void test_lexmin(struct isl_ctx *ctx) { const char *str; @@ -1348,6 +1360,7 @@ int main() assert(srcdir); ctx = isl_ctx_alloc(); + test_lex(ctx); test_sv(ctx); test_bijective(ctx); test_dep(ctx); -- 2.7.4