Fix type in the changelog entry,
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-43.C
blob7ef8508f416d3dc5ac70ea119f844b73ae055b18
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-ipa-inline-details -fno-ipa-cp -fno-early-inlining" } */
3 struct A {virtual int foo () {return 1;}};
4 struct B {int i; struct A a;};
5 struct C:A {virtual int foo () {return 2;}};
7 void dostuff(struct A *);
9 static void
10 test (struct A *a)
12   dostuff (a);
13   if (a->foo ()!= 2)
14     __builtin_abort ();
17 void
18 t(struct B *b)
20   test(&b->a);
22 /* Here b comes externally, but we take speculative hint from type of the pointer that it is
23    of type B.  This makes A fully specified and we know C::foo is unlikely.
24    FIXME: We could most probably can devirtualize unconditonally because dereference of b in
25    &b->a makes the type known.  GIMPLE does not represent this.  */
26 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a speculative target" 1 "inline" { xfail *-*-* } } } */