From 1b2fdb66ffd371c89f3ebeb0d06a3eef97a967ce Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 30 Jan 2012 15:23:18 +0100 Subject: [PATCH] schedule.c: split_parallel: avoid invalid memory accesses The original code incorrectly assumed that the schedules for all statements have the same number of columns, i.e., that the dimensions of the iteration domains of all statements are the same. We fix this up by simply bailing out if we find this assumption not to hold. We will improve the applicability of the transformation performed by split_parallel in a subsequent patch. Signed-off-by: Sven Verdoolaege --- isl_schedule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/isl_schedule.c b/isl_schedule.c index 175ed0a..65573f5 100644 --- a/isl_schedule.c +++ b/isl_schedule.c @@ -2252,6 +2252,8 @@ static int split_parallel(isl_ctx *ctx, struct isl_sched_graph *graph) for (i = 1; i < graph->n; ++i) { struct isl_sched_node *node = &graph->node[i]; + if (isl_mat_cols(node->sched) != cols) + return 0; if (!isl_seq_eq(node0->sched->row[row] + 1, node->sched->row[row] + 1, cols - 1)) return 0; -- 2.7.4