brintos

brintos / llvm-project-archived public Read only

0
0
Text · 785 B · 6150c93 Raw
20 lines · c
1// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -o - -fsanitize=address %s | FileCheck %s2 3// Ensure that ASan properly instruments a load into a global where the index4// happens to be within the padding after the global which is used for the5// 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.9int global_array[100] = {-1};10 11// This access is 412 bytes after the start of the global: past the end of the12// uninstrumented array, but within the bounds of the extended instrumented13// array. We should ensure this is still instrumented.14int main(void) { return global_array[103]; }15 16// CHECK: @main17// CHECK-NEXT: entry:18// CHECK: call void @__asan_report_load419// CHECK: }20