aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
Diffstat (limited to 'c.c')
-rw-r--r--c.c5
1 files changed, 2 insertions, 3 deletions
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));