History

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.

Philip committed 11 years ago

Commit 41260561 parent 44c330d1 file · +2 −1Browse files

Unified · Split

tccgen.c+2−1
@@ -4916,12 +4916,13 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 4915 unmodified lines
4916 size = type_size(&func_vt,&align);4916 size = type_size(&func_vt,&align);
4917 if ((vtop->r != (VT_LOCAL | VT_LVAL) || (vtop->c.i & (ret_align-1)))4917 if ((vtop->r != (VT_LOCAL | VT_LVAL) || (vtop->c.i & (ret_align-1)))
4918 && (align & (ret_align-1))) {4918 && (align & (ret_align-1))) {
4919 loc = (loc - size) & -align;4919 loc = (loc - size) & -ret_align;
4920 addr = loc;4920 addr = loc;
4921 type = func_vt;4921 type = func_vt;
4922 vset(&type, VT_LOCAL | VT_LVAL, addr);4922 vset(&type, VT_LOCAL | VT_LVAL, addr);
4923 vswap();4923 vswap();
4924 vstore();4924 vstore();
4925 vpop();
4925 vset(&ret_type, VT_LOCAL | VT_LVAL, addr);4926 vset(&ret_type, VT_LOCAL | VT_LVAL, addr);
4926 }4927 }
4927 vtop->type = ret_type;4928 vtop->type = ret_type;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t