Based on the failure from http://reviews.llvm.org/D7741. The gc-test.cc currently tests various accesses (underflows and overflows) to a local array and asserts that they are contained in the same stack, something like:
char var[15];
for (int i = -32; i < 15; i++) {
void *stack_A = __asan_addr_is_in_fake_stack(&var[0]); void *stack_B = __asan_addr_is_in_fake_stack(&var[i]); assert(stack_A == stack_B);
}
However, on i386, the left redzone is not 32 bytes, it’s only 16 bytes and therefore the access to var[-32] is completely off. The reason why this test didn’t fail before is that we’ve been lucky and there was another variable before the var array, which was also instrumented. This fix uses “-32” for 64-bit systems and “-16” for 32-bit.