1 // RUN: %clangxx_msan %s -O0 -fsanitize-memory-use-after-dtor -o %t && %run %t
2 // RUN: %clangxx_msan %s -O1 -fsanitize-memory-use-after-dtor -o %t && %run %t
3 // RUN: %clangxx_msan %s -O2 -fsanitize-memory-use-after-dtor -o %t && %run %t
4 // RUN: %clangxx_msan %s -DCVPTR=1 -O2 -fsanitize-memory-use-after-dtor -fsanitize-memory-track-origins -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CVPTR
5 // RUN: %clangxx_msan %s -DEAVPTR=1 -O2 -fsanitize-memory-use-after-dtor -fsanitize-memory-track-origins -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=EAVPTR
6 // RUN: %clangxx_msan %s -DEDVPTR=1 -O2 -fsanitize-memory-use-after-dtor -fsanitize-memory-track-origins -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=EDVPTR
8 // Expected to quit due to invalid access when invoking
9 // function using vtable.
18 virtual void A_Foo() {}
21 class B
: public virtual A
{
25 virtual void A_Foo() {}
37 virtual void D_Foo() {}
40 class E
: public virtual A
, public virtual D
{
48 // Simple linear inheritance
54 // CVPTR: Virtual table ptr was destroyed
55 // CVPTR: {{#0 0x.* in __sanitizer_dtor_callback_vptr}}
56 // CVPTR: {{#1 0x.* in ~C .*cpp:}}[[@LINE-28]]:
57 // CVPTR: {{#2 0x.* in main .*cpp:}}[[@LINE-7]]:
60 // Multiple inheritance, so has multiple vtables
66 // EAVPTR: Virtual table ptr was destroyed
67 // EAVPTR: {{#0 0x.* in __sanitizer_dtor_callback_vptr}}
68 // EAVPTR: {{#1 0x.* in ~E .*cpp:}}[[@LINE-25]]:
69 // EAVPTR: {{#2 0x.* in main .*cpp:}}[[@LINE-7]]:
74 // EDVPTR: Virtual table ptr was destroyed
75 // EDVPTR: {{#0 0x.* in __sanitizer_dtor_callback_vptr}}
76 // EDVPTR: {{#1 0x.* in ~E .*cpp:}}[[@LINE-33]]:
77 // EDVPTR: {{#2 0x.* in main .*cpp:}}[[@LINE-15]]: