| 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: } |