clast.c: insert_guard: create correct equality guards
commitc845144011e63743f7411e588734c2f26a9bfc80
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 10 May 2006 16:23:06 +0000 (10 18:23 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 11 May 2006 08:09:18 +0000 (11 10:09 +0200)
treec8f0c2e4aa7627cc50d178b760fa506e6de084b5
parent57581b1666d996e0d105eafe2adc86bc50fe18ff
clast.c: insert_guard: create correct equality guards

If the domains contains an equality

    a i_1 + b i_2 = 0

the original code would generate the guard

    if (i_2 == -a * i_1 / b)

However, -a * i_1 may not be an integer multiple of b and
so for any given value of i_2, the test could evaluate to true
for more than one value of i_1.
This happens in particular if the domain is part of
(the convex hull of a union of) a set of domains.
This patch generates the guard

    if (b * i_2 == -a * i_1)

instead, which should be safe.
source/clast.c
test/equality.c [new file with mode: 0644]
test/equality.cloog [new file with mode: 0644]
test/makefile