Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / vptr_harmful_race4.cpp
blob543514de8387d5eb3e0960152b55727369aee610
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
4 struct A {
5 virtual void F() {
8 virtual ~A() {
12 struct B : A {
13 virtual void F() {
17 void *Thread(void *x) {
18 barrier_wait(&barrier);
19 ((A*)x)->F();
20 return 0;
23 int main() {
24 barrier_init(&barrier, 2);
25 A *obj = new B;
26 pthread_t t;
27 pthread_create(&t, 0, Thread, obj);
28 delete obj;
29 barrier_wait(&barrier);
30 pthread_join(t, 0);
33 // CHECK: WARNING: ThreadSanitizer: heap-use-after-free (virtual call vs free)