summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/romcc/romcc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index 62fe758ef6..c2f5deed6c 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -7266,22 +7266,25 @@ static struct triple *do_mk_addr_expr(struct compile_state *state,
struct triple *expr, struct type *type, ulong_t offset)
{
struct triple *result;
- struct type *ptr_type;
clvalue(state, expr);
- ptr_type = new_type(TYPE_POINTER | (type->type & QUAL_MASK), type, 0);
-
result = 0;
if (expr->op == OP_ADECL) {
error(state, expr, "address of auto variables not supported");
}
else if (expr->op == OP_SDECL) {
+ struct type *ptr_type;
+ ptr_type = new_type(TYPE_POINTER | (type->type & QUAL_MASK), type, 0);
+
result = triple(state, OP_ADDRCONST, ptr_type, 0, 0);
MISC(result, 0) = expr;
result->u.cval = offset;
}
else if (expr->op == OP_DEREF) {
+ struct type *ptr_type;
+ ptr_type = new_type(TYPE_POINTER | (type->type & QUAL_MASK), type, 0);
+
result = triple(state, OP_ADD, ptr_type,
RHS(expr, 0),
int_const(state, &ulong_type, offset));