diff options
| author | 2025-11-22 14:08:55 +0100 | |
|---|---|---|
| committer | 2025-11-22 14:08:55 +0100 | |
| commit | 1780bdacc6be8d7f1fc487882ee1b3b1d318dd9d (patch) | |
| tree | 040aa26113871cda15397ac092e9ec1ba1854ba6 /c/eval.c | |
| parent | 81b5c5e677c597a1de49ce3ddc712005fe08fcfa (diff) | |
c: fix static eval for address of some array refs
Diffstat (limited to 'c/eval.c')
| -rw-r--r-- | c/eval.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -167,6 +167,8 @@ isaddrconst(struct expr *ex) return isaddrconst(ex->sub) || (eval(ex->sub, EVSTATICINI) && ex->sub->t == ENUMLIT); if (ex->t == EADDROF && (isglobsym(ex->sub) || (ex->sub->t == EGETF && isglobsym(ex->sub->sub)))) return 1; + if (ex->t == EGETF && ex->ty.t == TYARRAY && isglobsym(ex->sub)) + return 1; if (isglobsym(ex) && in_range(ex->ty.t, TYARRAY, TYFUNC)) return 1; if (ex->t == ESUB) @@ -294,7 +296,8 @@ eval(struct expr *ex, enum evalmode mode) struct expr *e = ex; while (e->t == ECAST) e = e->sub; if (e != ex) { - e->ty = ex->ty; + if (e->ty.t != TYARRAY) + e->ty = ex->ty; *ex = *e; } return 1; |