schedule.c: split_parallel: avoid invalid memory accesses
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 30 Jan 2012 14:23:18 +0000 (15:23 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 30 Jan 2012 14:23:18 +0000 (15:23 +0100)
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 <skimo@kotnet.org>
isl_schedule.c

index 175ed0a..65573f5 100644 (file)
@@ -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;