diff --git a/lib/bcheck.c b/lib/bcheck.c index b70116e5..cd7c8a79 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -588,8 +588,9 @@ void * __bound_ptr_indir ## dsize (void *p, size_t offset) \ if (addr <= tree->size) { \ if (tree->is_invalid || addr + offset + dsize > tree->size) { \ POST_SEM (); \ - bound_warning("%p is outside of the region (0x%lx..0x%lx)", \ - p + offset, (long)tree->start, \ + bound_warning("%p (size %d) is outside of the region " \ + "(0x%lx..0x%lx)", \ + p + offset, dsize, (long)tree->start, \ (long)(tree->start + tree->size - 1)); \ if (never_fatal <= 0) \ return INVALID_POINTER; /* return an invalid pointer */ \ diff --git a/tests/tests2/126_bound_global.expect b/tests/tests2/126_bound_global.expect index 969c20aa..23e941ef 100644 --- a/tests/tests2/126_bound_global.expect +++ b/tests/tests2/126_bound_global.expect @@ -1,2 +1,2 @@ -126_bound_global.c:11: at main: BCHECK: ........ is outside of the region (..................) +126_bound_global.c:11: at main: BCHECK: ........ (size 4) is outside of the region (..................) 126_bound_global.c:11: at main: RUNTIME ERROR: invalid memory access diff --git a/tests/tests2/132_bound_test.c b/tests/tests2/132_bound_test.c index 4898e8d7..f4162df0 100644 --- a/tests/tests2/132_bound_test.c +++ b/tests/tests2/132_bound_test.c @@ -21,9 +21,17 @@ double scale(double d) return x.d; } +void mul(double *p) +{ + *p *= 2.0; +} + int main(void) { + double d = 4.0; printf("%g\n", scale(42)); + mul(&d); + printf("%g\n", d); return 0; } diff --git a/tests/tests2/132_bound_test.expect b/tests/tests2/132_bound_test.expect index 6096bd1b..2da8dbe7 100644 --- a/tests/tests2/132_bound_test.expect +++ b/tests/tests2/132_bound_test.expect @@ -1 +1,2 @@ 42000 +8 diff --git a/x86_64-gen.c b/x86_64-gen.c index ad70b45b..985204e4 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -120,6 +120,7 @@ ST_FUNC void gen_struct_copy(int size); ST_DATA const char * const target_machine_defs = "__x86_64__\0" + "__x86_64\0" "__amd64__\0" ; @@ -2020,6 +2021,7 @@ void gen_opf(int op) gv(RC_FLOAT); vswap(); fc = vtop->c.i; /* bcheck may have saved previous vtop[-1] */ + r = vtop->r; } if ((ft & VT_BTYPE) == VT_DOUBLE) {