aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
author lemon<lsof@mailbox.org>2025-10-15 19:40:06 +0200
committer lemon<lsof@mailbox.org>2025-10-15 19:40:06 +0200
commit15d29261df4c92208754fe13bf289fb881084cb9 (patch)
tree5ace2fdb4316810ebb2c696ce5e1f3d850697914 /c.c
parent74145741f194f914ea479801a19d83708c8b72fd (diff)
be able to eval offsetof() macro
Diffstat (limited to 'c.c')
-rw-r--r--c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/c.c b/c.c
index 8224399..cf48425 100644
--- a/c.c
+++ b/c.c
@@ -1245,7 +1245,7 @@ iniwrite(struct comp *cm, struct initparser *ip, uint off, union type ty, struct
} else {
union ref sym;
vlong addend;
- efmt("<<> %ty <- %ty\n", ty, ex->ty);
+ //efmt("<<> %ty <- %ty\n", ty, ex->ty);
expr2reloc(&sym, &addend, ex);
assert(sym.t == RXCON);
if (!ip->dyn) {
@@ -3179,7 +3179,7 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard)
genstore(fn, ex->ty, r, q);
}
if (discard) return NOREF;
- return narrow(fn, cls, sub[0].ty, q, bitsiz);
+ return bitsiz ? narrow(fn, cls, sub[0].ty, q, bitsiz) : q;
case ESETMUL:
ins.op = isunsigned(ex->ty) ? Oumul : Omul;
goto Compound;
@@ -3234,7 +3234,7 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard)
genstore(fn, ex->ty, r, q);
}
if (discard) return NOREF;
- return narrow(fn, cls, ex->ty, q, bitsiz);
+ return bitsiz ? narrow(fn, cls, ex->ty, q, bitsiz) : q;
case ECALL:
r = compilecall(fn, ex);
if (isint(ex->ty))