150
|
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
|
|
9
|
|
10 // REQUIRES: stable-runtime
|
|
11
|
221
|
12 // Stack aliasing is not implemented on x86.
|
|
13 // XFAIL: x86_64
|
|
14
|
150
|
15 #include <stdlib.h>
|
|
16 #include <sanitizer/hwasan_interface.h>
|
|
17
|
|
18 __attribute__((noinline))
|
|
19 int f() {
|
|
20 char z[SIZE];
|
|
21 char *volatile p = z;
|
|
22 return p[SIZE];
|
|
23 }
|
|
24
|
|
25 int main() {
|
|
26 f();
|
|
27 // CHECK: READ of size 1 at
|
221
|
28 // CHECK: #0 {{.*}} in f{{.*}}stack-oob.c:[[@LINE-6]]
|
150
|
29
|
|
30 // CHECK: is located in stack of threa
|
|
31
|
|
32 // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in f
|
|
33 }
|