From 85dd122f81322a6de30e547ada17cf8ccf4869fd Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 27 Apr 2024 01:11:36 -0700 Subject: qbe: Use expression type when loading If we are loading the first element of an array, or first member of a structure, the expression type may be different from the object type. --- qbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qbe.c b/qbe.c index f76f792..a6781dd 100644 --- a/qbe.c +++ b/qbe.c @@ -678,7 +678,7 @@ funcexpr(struct func *f, struct expr *e) case EXPRIDENT: d = e->u.ident.decl; switch (d->kind) { - case DECLOBJECT: return funcload(f, d->type, (struct lvalue){d->value}); + case DECLOBJECT: return funcload(f, e->type, (struct lvalue){d->value}); case DECLCONST: return d->value; default: fatal("unimplemented declaration kind %d", d->kind); -- cgit v1.2.3