isl_ast_build_node_from_schedule fails on indirectly empty domain

1 view
Skip to first unread message

Michael Kruse

unread,
Feb 17, 2026, 3:32:51 PM (5 days ago) Feb 17
to isl Development
Hi,

this is a bug report derived from a crash in Polly:
https://github.com/llvm/llvm-project/issues/180958

Reproducing this problem is made easier by applying the patch below.
Otherwise, the call to isl_ast_build_node_from_schedule just returns
NULL, but should return a valid AST. I think the additional isl_assert
makes sense since if we apply a scale, we need that scale to be
defined.

```diff
--- a/isl_ast_build_expr.c
+++ b/isl_ast_build_expr.c
@@ -1005,6 +1005,9 @@ static isl_stat update_partial(struct
isl_parallel_stat *stat)
if (!stat->partial)
return isl_stat_ok;

+ isl_assert(isl_ast_build_get_ctx(stat->data->build), stat->f,
+ return isl_stat_error);
+
aff = isl_constraint_get_aff(stat->c);
aff = isl_aff_scale_val(aff, isl_val_copy(stat->f));
if (!stat->data->partial)
```

```
$ gcc islreduced.c -I ~/src/isl/include ~/src/isl/.libs/libisl.a -lgmp
-g -o islreduced && ./islreduced
### ISL version : isl-0.27-78-gfc484e00-GMP
### at generation: isl-0.27-78-gfc484e00-IMath-32
Crash expected here:
isl_ast_build_expr.c:1008: Assertion "stat->f" failed
Aborted (core dumped)
```

In addition to islreduced.c, I also attached the non-reduced
isltrace.c because I don't know how reliable the crash reducer is yet.
Having the additional isl_assert for crashing was necessary for the
reducer script to work.It could otherwise not have distinguished the
problem and passing an invalid input such as NULL.

The cause seems to be that a domain of the statement intersected with
the isl_ast_build is empty:

domain: [h, d, f] -> { [] : false }
generated: [h, d, f] -> { [] : false }
pending: [h, d, f] -> { [] }
iterators: ()
values: [h, d, f] -> { [] -> [] }
strides: []
offsets: [h, d, f] -> { [] -> [] }
internal2input: [h, d, f] -> { [] -> [] }

Here, the domain becomes empty after the call of
isl_ast_build_restrict_generated in isl_ast_build_expr_from_basic_set.
The Polly bug submitter also remarks the similarity to my previous
report with "isl crash: cannot handle void expression", which is also
caused by an empty domain.


Michael

--
Tardyzentrismus verboten!
isltrace.c
patch.diff
islreduced.c
Reply all
Reply to author
Forward
0 new messages