aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c/c.c3
-rw-r--r--c/eval.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/c/c.c b/c/c.c
index 019fb15..2c78937 100644
--- a/c/c.c
+++ b/c/c.c
@@ -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;
diff --git a/c/eval.c b/c/eval.c
index c004813..2f230c9 100644
--- a/c/eval.c
+++ b/c/eval.c
@@ -316,7 +316,8 @@ eval(struct expr *ex, enum evalmode mode)
return 1;
}
if (ex->t == ESTRLIT && mode > EVINTCONST) return 1;
- if (mode == EVSTATICINI && isptrcvt(ex->ty) && isaddrconst(ex)) {
+ if (mode == EVSTATICINI && (isptrcvt(ex->ty) || (isint(ex->ty) && typesize(ex->ty) == targ_primsizes[TYPTR]))
+ && isaddrconst(ex)) {
struct expr *e = ex;
while (e->t == ECAST) e = e->sub;
if (e != ex) {