aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorseyko <seyko2@gmail.com>2015-03-26 07:47:45 +0300
committerseyko <seyko2@gmail.com>2015-03-26 07:47:45 +0300
commitacef4ff244bb3b7af596d657e2f549e33c1daf43 (patch)
tree24d07535910d7479d26da01bf7bb7afcb4378e79 /tccgen.c
parent548a55eda53a0dcf2eabd617115c4e46330d7e23 (diff)
downloadtinycc-acef4ff244bb3b7af596d657e2f549e33c1daf43.tar.gz
tinycc-acef4ff244bb3b7af596d657e2f549e33c1daf43.tar.bz2
make a bound checking more compatible with Windows 64
On Linux 32: sizeof(long)=32 == sizeof(void *)=32 on Linux 64: sizeof(long)=64 == sizeof(void *)=64 on Windows 64: sizeof(long)=32 != sizeof(void *)=64
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tccgen.c b/tccgen.c
index 2478d4e..00a8086 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -5781,11 +5781,11 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
/* 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)) {
- unsigned long *bounds_ptr;
+ addr_t *bounds_ptr;
/* add padding between regions */
loc--;
/* then add local bound info */
- bounds_ptr = section_ptr_add(lbounds_section, 2 * sizeof(unsigned long));
+ bounds_ptr = section_ptr_add(lbounds_section, 2 * sizeof(addr_t));
bounds_ptr[0] = addr;
bounds_ptr[1] = size;
}
@@ -5892,11 +5892,11 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
/* handles bounds now because the symbol must be defined
before for the relocation */
if (tcc_state->do_bounds_check) {
- unsigned long *bounds_ptr;
+ addr_t *bounds_ptr;
greloc(bounds_section, sym, bounds_section->data_offset, R_DATA_PTR);
/* then add global bound info */
- bounds_ptr = section_ptr_add(bounds_section, 2 * sizeof(long));
+ bounds_ptr = section_ptr_add(bounds_section, 2 * sizeof(addr_t));
bounds_ptr[0] = 0; /* relocated */
bounds_ptr[1] = size;
}