[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / use-after-scope-temp2.cpp
blob369fdbeb172c21f12373c2fe94b0a0bd879de276
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 __attribute__((noinline)) const IntHolder &Self() const {
11 return *this;
13 int val = 3;
16 const IntHolder *saved;
18 int main(int argc, char *argv[]) {
19 saved = &IntHolder().Self();
20 int x = saved->val; // BOOM
21 // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
22 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp2.cpp:[[@LINE-2]]
23 // CHECK: Cause: stack tag-mismatch
24 return x;