From e471cfe5d94f47b7bcd95ce37e7d5c75997a7a67 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 22 Nov 2025 09:50:14 +0100 Subject: amd64/emit: fix REX-requiring 8-bit GPR encoding checking wrong reg --- c/c.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'c/c.c') diff --git a/c/c.c b/c/c.c index 5708419..5a0f5bd 100644 --- a/c/c.c +++ b/c/c.c @@ -3227,6 +3227,8 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard) case EPLUS: r = compileexpr(fn, sub, discard); if (discard) return NOREF; + if (isscalar(ex->ty) && typesize(ex->ty) < typesize(sub->ty)) + return narrow(fn, type2cls[scalartypet(ex->ty)], ex->ty, r, 0); return cvt(fn, ex->ty, sub->ty, r); case ENEG: op = Oneg; -- cgit v1.2.3