From 15d29261df4c92208754fe13bf289fb881084cb9 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 15 Oct 2025 19:40:06 +0200 Subject: be able to eval offsetof() macro --- c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'c.c') 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)) -- cgit v1.2.3