From b7f8f8baa65da3e9170cff0d9ccaca1dd7ff40a9 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 30 Jul 2013 15:01:58 +0200 Subject: [PATCH] discard incompletely extracted compound statements with variable declarations A compound statement with variable declarations must be extracted completely since the variable is assumed to be killed at the end of the scop. Signed-off-by: Sven Verdoolaege --- scan.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scan.cc b/scan.cc index d406dfb..dfbd44f 100644 --- a/scan.cc +++ b/scan.cc @@ -4854,6 +4854,12 @@ static struct pet_scop *mark_exposed(struct pet_scop *scop) * * If "block" is not set, then any array declared by one of the statements * in the sequence is marked as being exposed. + * + * If autodetect is set, then we allow the extraction of only a subrange + * of the sequence of statements. However, if there is at least one statement + * for which we could not construct a scop and the final range contains + * either no statements or at least one kill, then we discard the entire + * range. */ struct pet_scop *PetScan::extract(StmtRange stmt_range, bool block, bool skip_declarations) @@ -4915,7 +4921,7 @@ struct pet_scop *PetScan::extract(StmtRange stmt_range, bool block, } if (scop && partial_range) { - if (scop->n_stmt == 0) { + if (scop->n_stmt == 0 || kills.size() != 0) { pet_scop_free(scop); return NULL; } -- 2.11.4.GIT