Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/pr89698.C

raw
1 // { dg-do compile }
2 // { dg-options "-O -fdump-tree-fre1" }
3
4 class A {
5 virtual void f(){};
6 public:
7 int x;
8 A(int in): x(in) {};
9 };
10
11 class B: public A {
12 public:
13 int y;
14 B(int in):A(in-1), y(in) {};
15 };
16
17 void bar(void *);
18 void test()
19 {
20 B b(2);
21 A* bp = &b;
22 void* vp = dynamic_cast<void*>(bp);
23 bar (vp);
24 }
25
26 // We should be able to constant fold from the virtual table
27 // the offset added to bp for the dynamic cast and forward
28 // &b to the argument of bar
29 // { dg-final { scan-tree-dump "bar \\\(&b" "fre1" } }