From c0719f0fbb21d16a786fdf202c7f424e40abf51b Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Sun, 14 Aug 2011 14:10:09 -0700 Subject: [PATCH] Fix inlining switch statement. In sparse, inline is replacing the function call expression with a compound statment of inline function body. During the process, all reference to the function arguments need to replaced with calling arguments. When inlining the case statement. Sparse forgets to replace the case_label->stmt to the new version. If it has inner inline function call, it will cause the orignal copy of the function definition get modified. That should never happen. It cause warning error when the inline function call the second time. With this change, validations/bug_inline_switch.c no longer generate warning. Signed-off-by: Christopher Li --- inline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/inline.c b/inline.c index 860c0eea..9ed45709 100644 --- a/inline.c +++ b/inline.c @@ -381,6 +381,7 @@ static struct statement *copy_one_statement(struct statement *stmt) case STMT_CASE: { stmt = dup_statement(stmt); stmt->case_label = copy_symbol(stmt->pos, stmt->case_label); + stmt->case_label->stmt = stmt; stmt->case_expression = copy_expression(stmt->case_expression); stmt->case_to = copy_expression(stmt->case_to); stmt->case_statement = copy_one_statement(stmt->case_statement); -- 2.11.4.GIT