Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / cfi / vtable-may-alias.cpp
blobf63b53b8c9e64435af10e97ad2b5ad5648b59677
1 // RUN: %clangxx_cfi -o %t %s
2 // RUN: %run %t
4 // In this example, both __typeid_A_global_addr and __typeid_B_global_addr will
5 // refer to the same address. Make sure that the compiler does not assume that
6 // they do not alias.
8 struct A {
9 virtual void f() = 0;
12 struct B : A {
13 virtual void f() {}
16 __attribute__((weak)) void foo(void *p) {
17 B *b = (B *)p;
18 A *a = (A *)b;
19 a->f();
22 int main() {
23 B b;
24 foo(&b);