isl_tab_pip.c: compare all coefficients when checking for duplicate divs
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 15 Jun 2010 21:31:41 +0000 (23:31 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 15 Jun 2010 21:35:21 +0000 (23:35 +0200)
Due to a typo, we would not consider the last coefficient of the div,
possibly resulting in a new div being identified with an existing
div that only differs in that last coefficient.
Apparently, this doesn't happen very often, because it has gone
unnoticed for quite a while.

isl_tab_pip.c
isl_test.c

index 4698071..3c44086 100644 (file)
@@ -1788,7 +1788,7 @@ static int find_div(struct isl_tab *tab, isl_int *div, isl_int denom)
        for (i = 0; i < tab->bmap->n_div; ++i) {
                if (isl_int_ne(tab->bmap->div[i][0], denom))
                        continue;
-               if (!isl_seq_eq(tab->bmap->div[i] + 1, div, total))
+               if (!isl_seq_eq(tab->bmap->div[i] + 1, div, 1 + total))
                        continue;
                return i;
        }
index 10db162..10e942a 100644 (file)
@@ -1038,6 +1038,8 @@ void test_lexmin(struct isl_ctx *ctx)
 {
        const char *str;
        isl_map *map;
+       isl_set *set;
+       isl_set *set2;
 
        str = "[p0, p1] -> { [] -> [] : "
            "exists (e0 = [(2p1)/3], e1, e2, e3 = [(3 - p1 + 3e0)/3], "
@@ -1054,6 +1056,16 @@ void test_lexmin(struct isl_ctx *ctx)
        map = isl_map_read_from_str(ctx, str, -1);
        map = isl_map_lexmin(map);
        isl_map_free(map);
+
+       str = "[C] -> { [obj,a,b,c] : obj <= 38 a + 7 b + 10 c and "
+           "a + b <= 1 and c <= 10 b and c <= C and a,b,c,C >= 0 }";
+       set = isl_set_read_from_str(ctx, str, -1);
+       set = isl_set_lexmax(set);
+       str = "[C] -> { [obj,a,b,c] : C = 8 }";
+       set2 = isl_set_read_from_str(ctx, str, -1);
+       set = isl_set_intersect(set, set2);
+       assert(!isl_set_is_empty(set));
+       isl_set_free(set);
 }
 
 struct must_may {