aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlas, Zdenek <zden3k@gmail.com>2016-11-10 05:05:47 -0800
committerPavlas, Zdenek <zden3k@gmail.com>2016-11-10 05:15:07 -0800
commit7e7f2e5d1b40231f56fb1153a2831a216396a2ac (patch)
treef1e360b1aed3c47ac463416cea6521f8f327c620
parent550e861bf7a2196cec7d7844526c3f11e810c5be (diff)
downloadtinycc-7e7f2e5d1b40231f56fb1153a2831a216396a2ac.tar.gz
tinycc-7e7f2e5d1b40231f56fb1153a2831a216396a2ac.tar.bz2
bcheck: access fields of local structs w/o bcheck
Revert previous commit, this is probably a better fix.
-rw-r--r--tccgen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tccgen.c b/tccgen.c
index a8e1e97..73371c0 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -4488,7 +4488,7 @@ ST_FUNC void unary(void)
vtop->r |= lvalue_type(vtop->type.t);
#ifdef CONFIG_TCC_BCHECK
/* if bound checking, the referenced pointer must be checked */
- if (tcc_state->do_bounds_check)
+ if (tcc_state->do_bounds_check && (vtop->r & VT_VALMASK) != VT_LOCAL)
vtop->r |= VT_MUSTBOUND;
#endif
}
@@ -6234,7 +6234,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
if ((r & VT_VALMASK) == VT_LOCAL) {
sec = NULL;
#ifdef CONFIG_TCC_BCHECK
- if (tcc_state->do_bounds_check && ((type->t & VT_ARRAY) || (type->t & VT_BTYPE) == VT_STRUCT)) {
+ if (tcc_state->do_bounds_check && (type->t & VT_ARRAY)) {
loc--;
}
#endif
@@ -6244,7 +6244,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
/* handles bounds */
/* XXX: currently, since we do only one pass, we cannot track
'&' operators, so we add only arrays */
- if (tcc_state->do_bounds_check && ((type->t & VT_ARRAY) || (type->t & VT_BTYPE) == VT_STRUCT)) {
+ if (tcc_state->do_bounds_check && (type->t & VT_ARRAY)) {
addr_t *bounds_ptr;
/* add padding between regions */
loc--;