repo.or.cz
/
llvm-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git]
/
compiler-rt
/
test
/
cfi
/
vtable-may-alias.cpp
blob
f63b53b8c9e64435af10e97ad2b5ad5648b59677
1
// RUN: %clangxx_cfi -o %t %s
2
// RUN: %run %t
3
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.
7
8
struct
A
{
9
virtual
void
f
() =
0
;
10
};
11
12
struct
B
:
A
{
13
virtual
void
f
() {}
14
};
15
16
__attribute__
((
weak
))
void
foo
(
void
*
p
) {
17
B
*
b
= (
B
*)
p
;
18
A
*
a
= (
A
*)
b
;
19
a
->
f
();
20
}
21
22
int
main
() {
23
B b
;
24
foo
(&
b
);
25
}