[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / use-after-scope-temp.cpp
blobd6c751ac73284d35b9a48624dbb87b94cc979812
1 // This is the ASAN test of the same name ported to HWAsan.
3 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -std=c++11 -O1 %s -o %t && \
4 // RUN: not %run %t 2>&1 | FileCheck %s
6 // REQUIRES: aarch64-target-arch
7 // REQUIRES: stable-runtime
9 struct IntHolder {
10 int val;
13 const IntHolder *saved;
15 __attribute__((noinline)) void save(const IntHolder &holder) {
16 saved = &holder;
19 int main(int argc, char *argv[]) {
20 save({argc});
21 int x = saved->val; // BOOM
22 // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
23 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cpp:[[@LINE-2]]
24 // CHECK: Cause: stack tag-mismatch
25 return x;