isl_map.c: order_divs: swap with correct div
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 6 Jun 2009 09:12:57 +0000 (11:12 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 7 Jun 2009 09:25:25 +0000 (11:25 +0200)
The bug in the original code could result in a div being swapped
with itself, in turn resulting in an infinite loop.

isl_map.c

index 818d462..7ee8767 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -3581,7 +3581,7 @@ static struct isl_basic_map *order_divs(struct isl_basic_map *bmap)
                                                            bmap->n_div-i);
                if (pos == -1)
                        continue;
-               swap_div(bmap, i, pos);
+               swap_div(bmap, i, i + pos);
                --i;
        }
        return bmap;