aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLinus Torvalds <torvalds@home.transmeta.com>2003-04-04 11:04:31 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:09 -0700
commit5f9ef429f5cfc5d626e44768c62efa02b43dc884 (patch)
treeaf793d9f99d443623b6dfbbd7feaef57dac8ec80
parent51d392ef668ec4125abfc0463587c15fdd4f8f8d (diff)
downloadsparse-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.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/evaluate.c b/evaluate.c
index 6e3515df..30a038c0 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -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;