fix vstack leak
I think this code only affects the ARM EABI target, and only when returning small structures that might be unaligned. However, it was both leaking vstack entries and failing to achieve what I think is its purpose, to ensure the sret argument would be aligned properly. Both issues fixed.
This commit is contained in:
3
tccgen.c
3
tccgen.c
@ -4916,12 +4916,13 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
|
|||||||
size = type_size(&func_vt,&align);
|
size = type_size(&func_vt,&align);
|
||||||
if ((vtop->r != (VT_LOCAL | VT_LVAL) || (vtop->c.i & (ret_align-1)))
|
if ((vtop->r != (VT_LOCAL | VT_LVAL) || (vtop->c.i & (ret_align-1)))
|
||||||
&& (align & (ret_align-1))) {
|
&& (align & (ret_align-1))) {
|
||||||
loc = (loc - size) & -align;
|
loc = (loc - size) & -ret_align;
|
||||||
addr = loc;
|
addr = loc;
|
||||||
type = func_vt;
|
type = func_vt;
|
||||||
vset(&type, VT_LOCAL | VT_LVAL, addr);
|
vset(&type, VT_LOCAL | VT_LVAL, addr);
|
||||||
vswap();
|
vswap();
|
||||||
vstore();
|
vstore();
|
||||||
|
vpop();
|
||||||
vset(&ret_type, VT_LOCAL | VT_LVAL, addr);
|
vset(&ret_type, VT_LOCAL | VT_LVAL, addr);
|
||||||
}
|
}
|
||||||
vtop->type = ret_type;
|
vtop->type = ret_type;
|
||||||
|
|||||||
Reference in New Issue
Block a user