diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-04 10:49:08 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:09 -0700 |
| commit | 51d392ef668ec4125abfc0463587c15fdd4f8f8d (patch) | |
| tree | 47542ad5274a5b51676b588b01948cf54c7e2cf9 | |
| parent | 112e133ea8c6ca654a44ae555741da9dca385499 (diff) | |
| download | sparse-dev-51d392ef668ec4125abfc0463587c15fdd4f8f8d.tar.gz | |
Update 'addressof' to work with the new symbol setup.
| -rw-r--r-- | evaluate.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -656,27 +656,18 @@ static struct symbol *evaluate_addressof(struct expression *expr) struct symbol *ctype, *symbol; struct expression *op = expr->unop; - - ctype = op->ctype; - - /* Simplify: &*(expr) => (expr) */ - if (op->type == EXPR_PREOP && op->op == '*') { - *expr = *op->unop; + if (op->type != EXPR_PREOP || op->op != '*') { + warn(expr->pos, "not an lvalue"); + return NULL; } - + ctype = op->ctype; symbol = alloc_symbol(expr->pos, SYM_PTR); symbol->ctype.base_type = ctype; symbol->ctype.alignment = POINTER_ALIGNMENT; symbol->bit_size = BITS_IN_POINTER; + + *expr = *op->unop; expr->ctype = symbol; - if (expr->unop->type == EXPR_SYMBOL) { - struct symbol *var = expr->unop->symbol; - if (var->ctype.modifiers & MOD_REGISTER) { - warn(expr->pos, "register variable and address-of do not mix"); - var->ctype.modifiers &= ~MOD_REGISTER; - } - var->ctype.modifiers |= MOD_ADDRESSABLE; - } return symbol; } |
