#define isl_realloc_array(ctx,ptr,type,n) \
isl_realloc(ctx,ptr,type,(n)*sizeof(type))
-#define isl_assert(ctx,test,code) assert(test)
+#define isl_assert(ctx,test,code) \
+ do { \
+ assert(test); \
+ if (0 && !ctx) { \
+ code; \
+ } \
+ } while(0)
#define isl_min(a,b) ((a < b) ? (a) : (b))
}
}
isl_basic_set_free(bset2);
- isl_assert(ctx, row == bset1->n_eq, goto error);
+ isl_assert(bset1->ctx, row == bset1->n_eq, goto error);
bset1 = isl_basic_set_normalize_constraints(bset1);
return bset1;
error:
if (ISL_F_ISSET(bset, ISL_BASIC_SET_EMPTY))
return bset;
- isl_assert(ctx, isl_basic_set_n_param(bset) == 0, goto error);
- isl_assert(ctx, bset->n_div == 0, goto error);
+ isl_assert(bset->ctx, isl_basic_set_n_param(bset) == 0, goto error);
+ isl_assert(bset->ctx, bset->n_div == 0, goto error);
dim = isl_basic_set_n_dim(bset);
bset = isl_basic_set_cow(bset);
bset = isl_basic_set_extend(bset, 0, dim, 0, 1, 0);
int i;
unsigned dim = isl_set_n_dim(set);
- isl_assert(ctx, set->n > 0, goto error);
- isl_assert(ctx, bounds->n_row == dim, goto error);
+ isl_assert(set->ctx, set->n > 0, goto error);
+ isl_assert(set->ctx, bounds->n_row == dim, goto error);
while (bounds->n_row > 1) {
slice = isl_set_copy(set);
while (isl_seq_first_non_zero(bounds->row[bounds->n_row-1],
bounds->n_col) == -1) {
bounds->n_row--;
- isl_assert(ctx, bounds->n_row > 1, goto error);
+ isl_assert(set->ctx, bounds->n_row > 1, goto error);
}
if (!wrap_facet(set, bounds->row[0],
bounds->row[bounds->n_row-1]))
isl_assert(ctx, pos < dim->n_out, return isl_dim_total(dim));
return pos + dim->nparam + dim->n_in;
default:
- isl_assert(ctx, 0, goto error);
+ isl_assert(ctx, 0, return isl_dim_total(dim));
}
return isl_dim_total(dim);
}
T = isl_mat_lin_to_aff(T);
isl_int_set(T->row[0][0], D);
T = isl_mat_right_inverse(T);
- isl_assert(ctx, isl_int_is_one(T->row[0][0]), goto error);
+ isl_assert(T->ctx, isl_int_is_one(T->row[0][0]), goto error);
T = isl_mat_transpose(T);
isl_mat_free(A);
isl_mat_free(U);
if (!B || !d)
goto error;
- isl_assert(ctx, B->n_row == d->size, goto error);
+ isl_assert(B->ctx, B->n_row == d->size, goto error);
cst = particular_solution(B, d);
if (!cst)
goto error;
*T2 = NULL;
if (!bset)
goto error;
- isl_assert(ctx, isl_basic_set_n_param(bset) == 0, goto error);
- isl_assert(ctx, bset->n_div == 0, goto error);
+ isl_assert(bset->ctx, isl_basic_set_n_param(bset) == 0, goto error);
+ isl_assert(bset->ctx, bset->n_div == 0, goto error);
dim = isl_basic_set_n_dim(bset);
- isl_assert(ctx, bset->n_eq <= dim, goto error);
+ isl_assert(bset->ctx, bset->n_eq <= dim, goto error);
if (bset->n_eq == 0)
return bset;
if (!bset || !bmap)
goto error;
- isl_assert(set->ctx, isl_basic_map_compatible_domain(bmap, bset),
+ isl_assert(bset->ctx, isl_basic_map_compatible_domain(bmap, bset),
goto error);
return (struct isl_basic_set *)
if (!bmap1 || !bmap2)
goto error;
- isl_assert(ctx,
+ isl_assert(bmap1->ctx,
isl_basic_map_n_in(bmap1) == isl_basic_map_n_in(bmap2), goto error);
- isl_assert(ctx,
+ isl_assert(bmap1->ctx,
isl_basic_map_n_param(bmap1) == isl_basic_map_n_param(bmap2),
goto error);
if (!map)
return NULL;
- isl_assert(ctx, pos < isl_map_dim(map, type), goto error);
+ isl_assert(map->ctx, pos < isl_map_dim(map, type), goto error);
for (i = 0; i < map->n; ++i) {
map->p[i] = isl_basic_map_fix_si(map->p[i], type, pos, value);
if (!map->p[i])
if (!bmap1 || !bmap2)
return NULL;
- isl_assert(map1->ctx, isl_dim_equal(bmap1->dim, bmap2->dim), goto error);
+ isl_assert(bmap1->ctx, isl_dim_equal(bmap1->dim, bmap2->dim), goto error);
map = isl_map_alloc_dim(isl_dim_copy(bmap1->dim), 2, 0);
if (!map)
if (!bmap1 || !bmap2)
goto error;
- isl_assert(map1->ctx, isl_dim_match(bmap1->dim, isl_dim_param,
+ isl_assert(bmap1->ctx, isl_dim_match(bmap1->dim, isl_dim_param,
bmap2->dim, isl_dim_param), goto error);
dim_result = isl_dim_product(isl_dim_copy(bmap1->dim),
isl_dim_copy(bmap2->dim));
if (!mat || !vec)
goto error;
- isl_assert(ctx, mat->n_col == vec->size, goto error);
+ isl_assert(mat->ctx, mat->n_col == vec->size, goto error);
prod = isl_vec_alloc(mat->ctx, mat->n_row);
if (!prod)
if (!mat || !vec)
goto error;
- isl_assert(ctx, mat->n_row == vec->size, goto error);
+ isl_assert(mat->ctx, mat->n_row == vec->size, goto error);
prod = isl_vec_alloc(mat->ctx, mat->n_col);
if (!prod)
if (!left || !right)
goto error;
- isl_assert(ctx, left->n_row == right->n_row, goto error);
- isl_assert(ctx, left->n_row >= 1, goto error);
- isl_assert(ctx, left->n_col >= 1, goto error);
- isl_assert(ctx, right->n_col >= 1, goto error);
- isl_assert(ctx,
+ isl_assert(left->ctx, left->n_row == right->n_row, goto error);
+ isl_assert(left->ctx, left->n_row >= 1, goto error);
+ isl_assert(left->ctx, left->n_col >= 1, goto error);
+ isl_assert(left->ctx, right->n_col >= 1, goto error);
+ isl_assert(left->ctx,
isl_seq_first_non_zero(left->row[0]+1, left->n_col-1) == -1,
goto error);
- isl_assert(ctx,
+ isl_assert(left->ctx,
isl_seq_first_non_zero(right->row[0]+1, right->n_col-1) == -1,
goto error);
if (pivot < 0) {
isl_int_clear(a);
isl_int_clear(b);
- isl_assert(ctx, pivot >= 0, goto error);
+ isl_assert(left->ctx, pivot >= 0, goto error);
}
pivot += row;
if (pivot != row)
isl_int_lcm(a, a, left->row[row][row]);
if (isl_int_is_zero(a)){
isl_int_clear(a);
- isl_assert(ctx, 0, goto error);
+ isl_assert(left->ctx, 0, goto error);
}
for (row = 0; row < left->n_row; ++row) {
isl_int_divexact(left->row[row][row], a, left->row[row][row]);
mat = isl_mat_cow(mat);
if (!mat)
return NULL;
- isl_assert(ctx, i < mat->n_col, goto error);
- isl_assert(ctx, j < mat->n_col, goto error);
+ isl_assert(mat->ctx, i < mat->n_col, goto error);
+ isl_assert(mat->ctx, j < mat->n_col, goto error);
for (r = 0; r < mat->n_row; ++r)
isl_int_swap(mat->row[r][i], mat->row[r][j]);
if (!left || !right)
goto error;
- isl_assert(ctx, left->n_col == right->n_row, goto error);
+ isl_assert(left->ctx, left->n_col == right->n_row, goto error);
prod = isl_mat_alloc(left->ctx, left->n_row, right->n_col);
if (!prod)
goto error;
int r;
struct isl_mat *H = NULL, *Q = NULL;
- isl_assert(ctx, M->n_row == M->n_col, goto error);
+ if (!M)
+ return NULL;
+
+ isl_assert(M->ctx, M->n_row == M->n_col, goto error);
M->n_row = row;
H = isl_mat_left_hermite(isl_mat_copy(M), 0, NULL, &Q);
M->n_row = M->n_col;
if (!H)
goto error;
for (r = 0; r < row; ++r)
- isl_assert(ctx, isl_int_is_one(H->row[r][r]), goto error);
+ isl_assert(M->ctx, isl_int_is_one(H->row[r][r]), goto error);
for (r = row; r < M->n_row; ++r)
isl_seq_cpy(M->row[r], Q->row[r], M->n_col);
isl_mat_free(H);
isl_int_clear(v);
return tab;
+error:
+ isl_tab_free(tab);
+ return NULL;
}
/* Check whether the sample value of the tableau is finite,
return -1;
tab = sol->context_tab;
- isl_assert(tab->mat->ctx, tab->bset, goto error);
- isl_assert(tab->mat->ctx, tab->samples, goto error);
- isl_assert(tab->mat->ctx, tab->samples->n_col == 1 + tab->n_var, goto error);
+ isl_assert(tab->mat->ctx, tab->bset, return -1);
+ isl_assert(tab->mat->ctx, tab->samples, return -1);
+ isl_assert(tab->mat->ctx, tab->samples->n_col == 1 + tab->n_var, return -1);
isl_int_init(v);
for (i = tab->n_outside; i < tab->n_sample; ++i) {