diff options
| author | 2025-11-22 14:08:55 +0100 | |
|---|---|---|
| committer | 2025-11-22 14:08:55 +0100 | |
| commit | 1780bdacc6be8d7f1fc487882ee1b3b1d318dd9d (patch) | |
| tree | 040aa26113871cda15397ac092e9ec1ba1854ba6 /c/c.c | |
| parent | 81b5c5e677c597a1de49ce3ddc712005fe08fcfa (diff) | |
c: fix static eval for address of some array refs
Diffstat (limited to 'c/c.c')
| -rw-r--r-- | c/c.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1255,7 +1255,9 @@ expr2reloc(union ref *psym, vlong *paddend, const struct expr *ex) { if (ex->t == EADDROF && globsym(psym, ex->sub)) { *paddend = 0; - } else if (ex->t == EADDROF && (ex->sub->t == EGETF && globsym(psym, ex->sub->sub))) { + } else if (ex->t == EADDROF && ex->sub->t == EGETF && globsym(psym, ex->sub->sub)) { + *paddend = ex->sub->fld.off; + } else if (ex->t == EGETF && ex->ty.t == TYARRAY && globsym(psym, ex->sub)) { *paddend = ex->sub->fld.off; } else if (globsym(psym, ex) && in_range(ex->ty.t, TYARRAY, TYFUNC)) { *paddend = 0; |