aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authormingodad <mingodad@gmail.com>2014-03-26 20:14:39 +0000
committermingodad <mingodad@gmail.com>2014-03-26 20:18:48 +0000
commit4bc83ac3933efa565ae3326b55fcd711b63c073d (patch)
tree1663fb50208db44968cfe371eee63d06c8b79a4f /libtcc.c
parentaa561d70119accb59a17f10f9ba69076fb0ab516 (diff)
downloadtinycc-4bc83ac3933efa565ae3326b55fcd711b63c073d.tar.gz
tinycc-4bc83ac3933efa565ae3326b55fcd711b63c073d.tar.bz2
After several days searching why my code refactoring to remove globals was crashing,
I found the problem it was because CValue stack variables have rubish as it inital values and assigning to a member that is smaller than the big union item and trying to recover it later as a different member gives bak garbage. ST_FUNC void vset(TCCState* tcc_state, CType *type, int r, int v) { CValue cval; memset(&cval, 0, sizeof(CValue)); cval.i = v; //,<<<<<<<<<<< here is the main bug that mix with garbage vsetc(tcc_state, type, r, &cval); } /* store a value or an expression directly in global data or in local array */ static void init_putv(TCCState* tcc_state, CType *type, Section *sec, unsigned long c, int v, int expr_type) { ... case VT_PTR: if (tcc_state->tccgen_vtop->r & VT_SYM) { greloc(tcc_state, sec, tcc_state->tccgen_vtop->sym, c, R_DATA_PTR); } //<<< on the next line is where we try to get the assigned value to cvalue.i as cvalue.ull *(addr_t *)ptr |= (tcc_state->tccgen_vtop->c.ull & bit_mask) << bit_pos; break; Also this patch makes vla tests pass on linux 32 bits
Diffstat (limited to 'libtcc.c')
0 files changed, 0 insertions, 0 deletions