Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / use-after-scope-loop.cpp
blobd687261a662a4dee398fb8e9e80bc8a54da7080d
1 // This is the ASAN test of the same name ported to HWAsan.
3 // RUN: %clangxx_hwasan -O1 %s -o %t && \
4 // RUN: not %run %t 2>&1 | FileCheck %s
6 // REQUIRES: aarch64-target-arch || riscv64-target-arch
8 int *p[3];
10 int main() {
11 for (int i = 0; i < 3; i++) {
12 int x;
13 p[i] = &x;
15 return **p; // BOOM
16 // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
17 // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]
18 // CHECK: Cause: stack tag-mismatch