Skip to content

Commit 16d3c0c

Browse files
committed
[test][asan] Limit scope of the var
1 parent e8ce5f1 commit 16d3c0c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler-rt/test/asan/TestCases/contiguous_container.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ void TestContainer(size_t capacity, size_t off_begin, bool poison_buffer) {
2424
char *st_beg = buffer + off_begin;
2525
char *st_end = st_beg + capacity;
2626
char *end = poison_buffer ? st_beg : st_end;
27-
char *old_end;
2827

2928
for (int i = 0; i < 1000; i++) {
3029
size_t size = rand() % (capacity + 1);
3130
assert(size <= capacity);
32-
old_end = end;
31+
char *old_end = end;
3332
end = st_beg + size;
3433
__sanitizer_annotate_contiguous_container(st_beg, st_end, old_end, end);
3534

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

5352
for (int i = 0; i <= capacity; i++) {
54-
old_end = end;
53+
char *old_end = end;
5554
end = st_beg + i;
5655
__sanitizer_annotate_contiguous_container(st_beg, st_end, old_end, end);
5756

0 commit comments

Comments
 (0)