Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / cxa_atexit.cpp
blob1c63bb9d3e6a5a542a1186c7a41ac10988d89fd0
1 // RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 %s -o %t && %run %t %p
3 // PR17377: C++ module destructors get stale argument shadow.
5 #include <stdio.h>
6 #include <stdlib.h>
7 class A {
8 public:
9 // This destructor get stale argument shadow left from the call to f().
10 ~A() {
11 if (this)
12 exit(0);
16 A a;
18 __attribute__((noinline))
19 void f(long x) {
22 int main(void) {
23 long x;
24 long * volatile p = &x;
25 // This call poisons TLS shadow for the first function argument.
26 f(*p);
27 return 0;