Skip to content

Commit 456a7e5

Browse files
committed
[clang][asan] Add test for ensuring PR52382 is fixed
The fix for PR52382 was already introduced in D112732 which ensures that module instrumentation always runs after function instrumentation. This adds a test that ensures the PR is addressed and prevent regression. Differential Revision: https://reviews.llvm.org/D113143
1 parent a5cd278 commit 456a7e5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

clang/test/CodeGen/pr52382.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -o - -fsanitize=address %s | FileCheck %s
2+
3+
// Ensure that ASan properly instruments a load into a global where the index
4+
// happens to be within the padding after the global which is used for the
5+
// redzone.
6+
7+
// This global is 400 bytes long, but gets padded with 112 bytes for redzones,
8+
// rounding the total size after instrumentation to 512.
9+
int global_array[100] = {-1};
10+
11+
// This access is 412 bytes after the start of the global: past the end of the
12+
// uninstrumented array, but within the bounds of the extended instrumented
13+
// array. We should ensure this is still instrumented.
14+
int main(void) { return global_array[103]; }
15+
16+
// CHECK: @main
17+
// CHECK-NEXT: entry:
18+
// CHECK: call void @__asan_report_load4
19+
// CHECK: }

0 commit comments

Comments
 (0)