diff options
author | Sven Verdoolaege <skimo@kotnet.org> | 2013-03-13 08:43:59 +0100 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2013-03-13 09:21:34 +0100 |
commit | ca10080dfcc861720c6354c4ec1b937f5eec106f (patch) | |
tree | 917e18527a6dc65793268e19f3c4812f8d200049 /isl_morph.c | |
parent | 74218a8133bd6864724192a1a58c83548012d578 (diff) | |
download | isl-ca10080dfcc861720c6354c4ec1b937f5eec106f.tar.gz isl-ca10080dfcc861720c6354c4ec1b937f5eec106f.tar.bz2 isl-ca10080dfcc861720c6354c4ec1b937f5eec106f.zip |
isl_basic_set_parameter_compression: extend assertion
We were only checking if the number of equalities is less than
or equal to the number of variables, while the code also assumes
that all of the equalities involves at least one variable.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_morph.c')
-rw-r--r-- | isl_morph.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/isl_morph.c b/isl_morph.c index b5bfa18a..9fc39d2e 100644 --- a/isl_morph.c +++ b/isl_morph.c @@ -473,6 +473,10 @@ error: * We basically just call isl_mat_parameter_compression with the right input * and then extend the resulting matrix to include the variables. * + * The implementation assumes that "bset" does not have any equalities + * that only involve the parameters and that isl_basic_set_gauss has + * been applied to "bset". + * * Let the equalities be given as * * B(p) + A x = 0 @@ -509,7 +513,14 @@ __isl_give isl_morph *isl_basic_set_parameter_compression( nparam = isl_basic_set_dim(bset, isl_dim_param); nvar = isl_basic_set_dim(bset, isl_dim_set); - isl_assert(bset->ctx, n_eq <= nvar, return NULL); + if (isl_seq_first_non_zero(bset->eq[bset->n_eq - 1] + 1 + nparam, + nvar) == -1) + isl_die(isl_basic_set_get_ctx(bset), isl_error_invalid, + "input not allowed to have parameter equalities", + return NULL); + if (n_eq > nvar) + isl_die(isl_basic_set_get_ctx(bset), isl_error_invalid, + "input not gaussed", return NULL); d = isl_vec_alloc(bset->ctx, n_eq); B = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, n_eq, 0, 1 + nparam); |