| 1 |
// RUN: %clang_hwasan -O0 -g %s -o %t && %env_hwasan_opts=strip_path_prefix=/TestCases/ not %run %t 2>&1 | FileCheck %s |
| 2 |
|
| 3 |
// Stack histories currently are not recorded on x86. |
| 4 |
// XFAIL: target=x86_64{{.*}} |
| 5 |
|
| 6 |
#include <assert.h> |
| 7 |
#include <sanitizer/hwasan_interface.h> |
| 8 |
#include <stdio.h> |
| 9 |
|
| 10 |
int t; |
| 11 |
|
| 12 |
__attribute__((noinline)) char *buggy() { |
| 13 |
char *volatile p; |
| 14 |
char zzz = {}; |
| 15 |
char yyy = {}; |
| 16 |
p = t ? &yyy : &zzz; |
| 17 |
return p; |
| 18 |
} |
| 19 |
|
| 20 |
int main() { |
| 21 |
char *p = buggy(); |
| 22 |
return *p; |
| 23 |
// CHECK: READ of size 1 at |
| 24 |
// CHECK: #0 {{.*}} in main strip_path_prefix.c:[[@LINE-2]] |
| 25 |
// CHECK: Potentially referenced stack objects: |
| 26 |
// CHECK: in buggy strip_path_prefix.c:[[@LINE-12]] |
| 27 |
} |