From baa20478658f8bf9d229f75574f93aa1b329b3d5 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Mon, 15 Sep 2008 14:35:35 +0000 Subject: [PATCH] Do not initialise the variables declared in a for statement, if the initialisation is not reachable. [r21976] --- ast2firm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index 09ec8e7..46e48d3 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -4378,12 +4378,13 @@ static void for_statement_to_firm(for_statement_t *statement) for( ; declaration != NULL; declaration = declaration->next) { create_local_declaration(declaration); } - declaration = statement->scope.declarations; - for( ; declaration != NULL; declaration = declaration->next) { - initialize_local_declaration(declaration); - } if (get_cur_block() != NULL) { + declaration = statement->scope.declarations; + for( ; declaration != NULL; declaration = declaration->next) { + initialize_local_declaration(declaration); + } + if (statement->initialisation != NULL) { expression_to_firm(statement->initialisation); } -- 2.20.1