From 6fa509e2e4b8708289aa9d182d10c6a3ffe1c08a Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 8 Dec 2025 18:52:00 +0100 Subject: eval: &*x address constants --- c/eval.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/c/eval.c b/c/eval.c index e7f2531..c9208b8 100644 --- a/c/eval.c +++ b/c/eval.c @@ -167,6 +167,10 @@ 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 == EADDROF && ex->sub->t == EDEREF && isaddrconst(ex->sub->sub)) { + *ex = *ex->sub->sub; + return 1; + } if (ex->t == EADDROF && ex->sub->t == EINIT) return eval(ex->sub, EVSTATICINI); if (ex->t == EGETF && ex->ty.t == TYARRAY && isglobsym(ex->sub)) -- cgit v1.2.3