From c6a0c940ac832a5b2ac2196ce42bc32f46ba9f58 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 4 Aug 2011 10:00:37 +0200 Subject: [PATCH] cuda_pet: check for NULL scop While we are at it, also remove an incorrect comment. Signed-off-by: Sven Verdoolaege --- cuda.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cuda.c b/cuda.c index 14a4b38..2e92500 100644 --- a/cuda.c +++ b/cuda.c @@ -4225,8 +4225,6 @@ static struct cuda_stmt *extract_stmts(isl_ctx *ctx, struct pet_scop *scop, * and including T2), with iterators g%d and after equating the H loops * to h%d parameters and the T1P loops to the block dimensions. * Finally, we generate code for the remaining loops in a similar fashion. - * - * The function frees "scop" and "ctx". */ int cuda_pet(isl_ctx *ctx, struct pet_scop *scop, struct ppcg_options *options, const char *input) @@ -4234,6 +4232,9 @@ int cuda_pet(isl_ctx *ctx, struct pet_scop *scop, struct ppcg_options *options, isl_union_map *sched; struct cuda_gen gen; + if (!scop) + return -1; + scop = pet_scop_align_params(scop); gen.ctx = ctx; -- 2.11.4.GIT