Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / use-after-scope-temp.cpp
blob29680f37bfa532e1421abf4b3271dd4094ce37ad
1 // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
3 struct IntHolder {
4 int val;
5 };
7 const IntHolder *saved;
9 __attribute__((noinline)) void save(const IntHolder &holder) {
10 saved = &holder;
13 int main(int argc, char *argv[]) {
14 save({argc});
15 int x = saved->val; // BOOM
16 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
17 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cpp:[[@LINE-2]]
18 return x;