[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / use-after-scope-temp2.cpp
blob54a8585153694d18d482ddf7eab7d77531f195e5
1 // This is the ASAN test of the same name ported to HWAsan.
3 // RUN: %clangxx_hwasan -std=c++11 -O1 %s -o %t && \
4 // RUN: not %run %t 2>&1 | FileCheck %s
6 // REQUIRES: aarch64-target-arch || riscv64-target-arch
8 struct IntHolder {
9 __attribute__((noinline)) const IntHolder &Self() const {
10 return *this;
12 int val = 3;
15 const IntHolder *saved;
17 int main(int argc, char *argv[]) {
18 saved = &IntHolder().Self();
19 int x = saved->val; // BOOM
20 // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
21 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp2.cpp:[[@LINE-2]]
22 // CHECK: Cause: stack tag-mismatch
23 return x;