This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Fix gc-test.cc to work under higher -O levels
ClosedPublic

Authored by kubamracek on Feb 21 2015, 2:25 AM.

Details

Reviewers
samsonov
Summary

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.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 20459.Feb 21 2015, 2:25 AM
kubamracek retitled this revision from to [compiler-rt] Fix gc-test.cc to work under higher -O levels.
kubamracek updated this object.
kubamracek edited the test plan for this revision. (Show Details)
kubamracek added subscribers: Unknown Object (MLST), zaks.anna, kcc and 2 others.
samsonov accepted this revision.Feb 21 2015, 3:42 PM
samsonov added a reviewer: samsonov.

LGTM.

Awesome, thanks!

This revision is now accepted and ready to land.Feb 21 2015, 3:42 PM
kubamracek closed this revision.Feb 22 2015, 3:45 AM

Landed in r230172.