aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@www.linux.org.uk>2004-08-13 22:58:54 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:02:47 -0700
commit4322eac12717a41c8c4cb361a3f70038f4d80aa8 (patch)
tree88b9cc4ece3be9f14a0e30fa243a76a8cbe658b2 /inline.c
parentFix nonterminated ident matching. (diff)
downloadsparse-4322eac12717a41c8c4cb361a3f70038f4d80aa8.tar.gz
sparse-4322eac12717a41c8c4cb361a3f70038f4d80aa8.tar.bz2
sparse-4322eac12717a41c8c4cb361a3f70038f4d80aa8.zip
[PATCH] inline declaration getting clobbered by expansion
When we copy the body of inlined function, we leave more nodes shared than we should - they might be mangled by evaluation of copy. Fixed. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'inline.c')
-rw-r--r--inline.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/inline.c b/inline.c
index d4323c9..f5a04d1 100644
--- a/inline.c
+++ b/inline.c
@@ -102,8 +102,7 @@ static struct expression * copy_expression(struct expression *expr)
case EXPR_BINOP:
case EXPR_COMMA:
case EXPR_COMPARE:
- case EXPR_LOGICAL:
- case EXPR_ASSIGNMENT: {
+ case EXPR_LOGICAL: {
struct expression *left = copy_expression(expr->left);
struct expression *right = copy_expression(expr->right);
if (left == expr->left && right == expr->right)
@@ -114,11 +113,20 @@ static struct expression * copy_expression(struct expression *expr)
break;
}
+ case EXPR_ASSIGNMENT: {
+ struct expression *left = copy_expression(expr->left);
+ struct expression *right = copy_expression(expr->right);
+ if (expr->op == '=' && left == expr->left && right == expr->right)
+ break;
+ expr = dup_expression(expr);
+ expr->left = left;
+ expr->right = right;
+ break;
+ }
+
/* Dereference */
case EXPR_DEREF: {
struct expression *deref = copy_expression(expr->deref);
- if (deref == expr->deref)
- break;
expr = dup_expression(expr);
expr->deref = deref;
break;