From d84b70af9a3a7f7a9a7fe5d2913f946c2e5314b6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 21 Jul 2017 16:11:49 +0200 Subject: [PATCH] isl_stream_read_map: fix handling of empty optional formula An empty optional formula should not affect the map being parsed, but this was broken in isl-0.07-39-g62808ce5b4 (isl_stream_read_map: use affine expressions during parsing, Mon Jul 25 09:36:00 2011 +0200). Prior to this commit, the caller of read_disjuncts would intersect the result with the constraints derived from the tuples. Since this commit, these constraints are passed to read_disjuncts instead and returned back together with the parsed disjuncts. The case of an empty formula failed to be adjusted accordingly. Simply return the original constraints instead of returning a universe map. Signed-off-by: Sven Verdoolaege --- isl_input.c | 7 ++----- isl_test.c | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/isl_input.c b/isl_input.c index 71976173..7dbd5de6 100644 --- a/isl_input.c +++ b/isl_input.c @@ -1805,11 +1805,8 @@ static struct isl_map *read_disjuncts(__isl_keep isl_stream *s, { isl_map *res; - if (isl_stream_next_token_is(s, '}')) { - isl_space *dim = isl_map_get_space(map); - isl_map_free(map); - return isl_map_universe(dim); - } + if (isl_stream_next_token_is(s, '}')) + return map; res = read_conjuncts(s, v, isl_map_copy(map), rational); while (isl_stream_eat_if_available(s, ISL_TOKEN_OR)) { diff --git a/isl_test.c b/isl_test.c index 01f3e6d2..a3285ca7 100644 --- a/isl_test.c +++ b/isl_test.c @@ -190,6 +190,8 @@ struct { { "{ [x] -> [] : exists (a, b: 0 <= a <= 1 and 0 <= b <= 3 and " "2b <= x - 8a and 2b >= -1 + x - 8a) }", "{ [x] -> [] : 0 <= x <= 15 }" }, + { "{ [x] -> [x] : }", + "{ [x] -> [x] }" }, }; int test_parse(struct isl_ctx *ctx) -- 2.11.4.GIT