diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-04 11:04:31 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:09 -0700 |
| commit | 5f9ef429f5cfc5d626e44768c62efa02b43dc884 (patch) | |
| tree | af793d9f99d443623b6dfbbd7feaef57dac8ec80 | |
| parent | 51d392ef668ec4125abfc0463587c15fdd4f8f8d (diff) | |
| download | sparse-dev-5f9ef429f5cfc5d626e44768c62efa02b43dc884.tar.gz | |
Verify lvalue'ness on assignment - since we now make symbol
evaluation become the dereference of the symbol address, the
test for lvalue'ness is trivially to check that the top
expression is a dereference.
| -rw-r--r-- | evaluate.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -635,13 +635,9 @@ static struct symbol *evaluate_assignment(struct expression *expr) right = expr->right; } - if (!ltype) { - warn(expr->pos, "what? no ltype"); - return 0; - } - if (!rtype) { - warn(expr->pos, "what? no rtype"); - return 0; + if (left->type != EXPR_PREOP || left->op != '*') { + warn(expr->pos, "not an lvalue"); + return NULL; } if (!compatible_assignment_types(expr, ltype, &expr->right, rtype)) @@ -876,12 +872,6 @@ static struct symbol *evaluate_sizeof(struct expression *expr) return size_t_ctype; } -static struct symbol *evaluate_lvalue_expression(struct expression *expr) -{ - // FIXME! - return evaluate_expression(expr); -} - static int evaluate_expression_list(struct expression_list *head) { if (head) { @@ -1055,7 +1045,7 @@ struct symbol *evaluate_expression(struct expression *expr) return NULL; return evaluate_compare(expr); case EXPR_ASSIGNMENT: - if (!evaluate_lvalue_expression(expr->left)) + if (!evaluate_expression(expr->left)) return NULL; if (!evaluate_expression(expr->right)) return NULL; |
