From 42398637d6c6806885a381f3dc763572af12f93a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 11 Apr 2018 22:31:49 +0200 Subject: [PATCH] isl_aff_set_tuple_id: fix check for type of tuple that can be set The comment on the function correctly states that the type is required to be equal to isl_dim_in, but the code introduced in isl-0.12.1-153-g9da631b7d4 (add isl_aff_set_tuple_id, Sat Oct 12 20:31:17 2013 +0200) would check for isl_dim_out instead. Signed-off-by: Sven Verdoolaege --- isl_aff.c | 2 +- isl_test.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/isl_aff.c b/isl_aff.c index bec37964..ffa88141 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -1990,7 +1990,7 @@ __isl_give isl_aff *isl_aff_set_tuple_id(__isl_take isl_aff *aff, aff = isl_aff_cow(aff); if (!aff) goto error; - if (type != isl_dim_out) + if (type != isl_dim_in) isl_die(aff->v->ctx, isl_error_invalid, "cannot only set id of input tuple", goto error); aff->ls = isl_local_space_set_tuple_id(aff->ls, isl_dim_set, id); diff --git a/isl_test.c b/isl_test.c index 03063475..f6ad0a0a 100644 --- a/isl_test.c +++ b/isl_test.c @@ -4892,6 +4892,25 @@ static int test_mupa_uset(isl_ctx *ctx) return 0; } +/* Check that the input tuple of an isl_aff can be set properly. + */ +static isl_stat test_aff_set_tuple_id(isl_ctx *ctx) +{ + isl_id *id; + isl_aff *aff; + int equal; + + aff = isl_aff_read_from_str(ctx, "{ [x] -> [x + 1] }"); + id = isl_id_alloc(ctx, "A", NULL); + aff = isl_aff_set_tuple_id(aff, isl_dim_in, id); + equal = aff_check_plain_equal(aff, "{ A[x] -> [x + 1] }"); + isl_aff_free(aff); + if (equal < 0) + return isl_stat_error; + + return isl_stat_ok; +} + int test_aff(isl_ctx *ctx) { const char *str; @@ -4947,6 +4966,9 @@ int test_aff(isl_ctx *ctx) if (equal < 0) return -1; + if (test_aff_set_tuple_id(ctx) < 0) + return -1; + return 0; } -- 2.11.4.GIT