diff options
author | Alexander Viro <viro@www.linux.org.uk> | 2004-08-13 22:58:54 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:02:47 -0700 |
commit | 4322eac12717a41c8c4cb361a3f70038f4d80aa8 (patch) | |
tree | 88b9cc4ece3be9f14a0e30fa243a76a8cbe658b2 /inline.c | |
parent | Fix nonterminated ident matching. (diff) | |
download | sparse-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.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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; |