[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / stack-oob.c
blob1e6cefaf03f184ad89be993750e4fc37fa978861
1 // RUN: %clang_hwasan_oldrt -DSIZE=2 -O0 %s -o %t && %run %t
2 // RUN: %clang_hwasan -DSIZE=2 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
3 // RUN: %clang_hwasan_oldrt -DSIZE=15 -O0 %s -o %t && %run %t
4 // RUN: %clang_hwasan -DSIZE=15 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
5 // RUN: %clang_hwasan_oldrt -DSIZE=16 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
6 // RUN: %clang_hwasan -DSIZE=16 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
7 // RUN: %clang_hwasan -DSIZE=64 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
8 // RUN: %clang_hwasan -DSIZE=0x1000 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
10 // REQUIRES: stable-runtime
12 // Stack short granules are currently not implemented on x86.
13 // XFAIL: x86_64
15 #include <stdlib.h>
16 #include <sanitizer/hwasan_interface.h>
18 __attribute__((noinline))
19 int f() {
20 char z[SIZE];
21 char *volatile p = z;
22 return p[SIZE];
25 int main() {
26 f();
27 // CHECK: READ of size 1 at
28 // CHECK: #0 {{.*}} in f{{.*}}stack-oob.c:[[@LINE-6]]
30 // CHECK-NOT: Cause: global-overflow
31 // CHECK: Cause: stack tag-mismatch
32 // CHECK: is located in stack of threa
33 // CHECK-NOT: Cause: global-overflow
35 // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in f