diff options
| author | 2026-02-25 17:57:39 +0100 | |
|---|---|---|
| committer | 2026-02-25 17:57:39 +0100 | |
| commit | 6c3f1593e953393f4b9329a0c47c5af0a587c8c9 (patch) | |
| tree | 58449aba9d86ecc9e6259c4f8a8c4b5c7f71dfdd /c/c.c | |
| parent | 70fa08eb98a7304b3dbcba49417219d2a6fbd2b9 (diff) | |
c: allow casting of symbol address to intptr_t in static initializers
Diffstat (limited to 'c/c.c')
| -rw-r--r-- | c/c.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1418,7 +1418,8 @@ expr2reloc(union ref *psym, const struct expr *ex) { if (ex->t == EADDROF && globsym(psym, ex->sub)) { return 0; - } else if (isptrcvt(ex->ty) && globsym(psym, ex)) { + } else if ((isptrcvt(ex->ty) || (isint(ex->ty) && typesize(ex->ty) == targ_primsizes[TYPTR])) + && globsym(psym, ex)) { return 0; } else if (ex->t == EADDROF && ex->sub->t == EGETF && globsym(psym, ex->sub->sub)) { return ex->sub->fld.off; |