From 0fb2b5712cc98ea993f37bd86eeed89fddc5d6d9 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 10 Oct 2025 22:34:17 +0200 Subject: bugfixes --- c.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'c.c') diff --git a/c.c b/c.c index 26765a2..30ea13a 100644 --- a/c.c +++ b/c.c @@ -3659,8 +3659,7 @@ localdecl(struct comp *cm, struct function *fn, bool forini) goto Err; } EMITS { - /*actual alloca filled in later (for inferred array size decls)*/ - decl.id = addinstr(fn, mkinstr(Oalloca1, KPTR, mkref(RICON, -1))).i; + decl.id = addinstr(fn, mkalloca(typesize(decl.ty), typealign(decl.ty))).i; } Initz: if (st.varini) { @@ -3685,7 +3684,7 @@ localdecl(struct comp *cm, struct function *fn, bool forini) d->ty, ini.ty); } EMITS { - if (ini.t == EINIT || ini.t == ESTRLIT) + if (ini.t == EINIT || (d->ty.t == TYARRAY && ini.t == ESTRLIT)) geninit(fn, d->ty, mkref(RTMP, decl.id), &ini); else if (isagg(d->ty)) structcopy(fn, d->ty, mkref(RTMP, decl.id), exprvalue(fn, &ini)); -- cgit v1.2.3