1 // Fails with debug checks: https://bugs.llvm.org/show_bug.cgi?id=46862
2 // XFAIL: !compiler-rt-optimized && !riscv64
3 
4 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %dynamiclib1
5 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %dynamiclib2
6 // RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
7 // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
8 
9 struct XYZ {
10   virtual void foo();
11 };
12 
13 #if defined(BUILD_SO1)
14 
15 void XYZ::foo() {}
16 
17 #elif defined(BUILD_SO2)
18 
19 void XYZ::foo() {}
20 
21 #else
22 
23 int main() {}
24 
25 #endif
26 
27 // CHECK: AddressSanitizer: odr-violation
28 // CHECK-NEXT: 'vtable for XYZ'
29 // CHECK-NEXT: 'vtable for XYZ'
30