diff options
| author | 2025-12-08 18:52:00 +0100 | |
|---|---|---|
| committer | 2025-12-08 18:52:00 +0100 | |
| commit | 6fa509e2e4b8708289aa9d182d10c6a3ffe1c08a (patch) | |
| tree | d182510f10adad1dd4791d00584f87e783b2ea53 | |
| parent | a9ffc8b7464e317874a54efe796dbefd3a7f829d (diff) | |
eval: &*x address constants
| -rw-r--r-- | c/eval.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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)) |