Skip to content

Commit

Permalink
[test][asan] Limit scope of the var
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka committed Nov 22, 2022
1 parent e8ce5f1 commit 16d3c0c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler-rt/test/asan/TestCases/contiguous_container.cpp
Expand Up @@ -24,12 +24,11 @@ void TestContainer(size_t capacity, size_t off_begin, bool poison_buffer) {
char *st_beg = buffer + off_begin;
char *st_end = st_beg + capacity;
char *end = poison_buffer ? st_beg : st_end;
char *old_end;

for (int i = 0; i < 1000; i++) {
size_t size = rand() % (capacity + 1);
assert(size <= capacity);
old_end = end;
char *old_end = end;
end = st_beg + size;
__sanitizer_annotate_contiguous_container(st_beg, st_end, old_end, end);

Expand All @@ -51,7 +50,7 @@ void TestContainer(size_t capacity, size_t off_begin, bool poison_buffer) {
}

for (int i = 0; i <= capacity; i++) {
old_end = end;
char *old_end = end;
end = st_beg + i;
__sanitizer_annotate_contiguous_container(st_beg, st_end, old_end, end);

Expand Down

0 comments on commit 16d3c0c

Please sign in to comment.