From 13471741b538baa45cd53a521cf7d52087f3200f Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 5 Nov 2025 13:56:54 +0100 Subject: amd64: fix aggregate abi stuff;; ir: fold, peephole optimizing constructors --- c/eval.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'c/eval.c') diff --git a/c/eval.c b/c/eval.c index 1f61a7f..7e6e43e 100644 --- a/c/eval.c +++ b/c/eval.c @@ -29,6 +29,7 @@ numcast(union type ty, struct expr *dst, const struct expr *src) struct expr tmp; enum typetag td = targ2hosttype(ty.t); enum typetag ts = targ2hosttype(src->ty.t == TYENUM ? src->ty.backing : src->ty.t); + vlong isrc; if (src == dst) tmp = *src, src = &tmp; assert(src->t == ENUMLIT); @@ -45,11 +46,12 @@ numcast(union type ty, struct expr *dst, const struct expr *src) else if (td == TYDOUBLE) dst->f = (double) src->i; else if (TF(TYUVLONG)) dst->u = src->f; else if (TF(TYBOOL)) dst->i = (bool) src->f; - else if (isfltt(ts)) { dst->i = src->f; goto Narrow; } + else if (isfltt(ts)) { isrc = src->f; goto Narrow; } else { + isrc = src->i; Narrow: switch (td) { -#define I(Ty, Tag) case Tag: dst->i = (Ty) src->i; break; +#define I(Ty, Tag) case Tag: dst->i = (Ty) isrc; break; I(bool, TYBOOL) I(signed char, TYSCHAR) I(unsigned char, TYUCHAR) -- cgit v1.2.3