ICF is more strict about non-common function and var
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-24.C
blob6ac4b606d88cb4b24ee0f14c10a9671775f44be3
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-inline -fdump-ipa-cp"  } */
3 void pad(void);
4 class A {};
5 class B {
6 public:
7   A &operator[](int);
8 };
9 class C : B {
10 public:
11   virtual int m_fn1() { return 0; }
12   inline A &operator[](int p1) {
13     int a;
14     a = m_fn1();
15     static_cast<void>(__builtin_expect(a, 0) ?: 0);
16     return B::operator[](p1);
17   }
20 int *e;
21 static void sort(C &p1, C &p2) {
22   for (int i=0;; i++) {
23     A c, d = p2[0];
24         pad();
25         pad();
26         pad();
27   }
30 int test ();
32 void update_sources() {
33 while (test()) {
34     C f;
35 C *b = new (C);
36     sort(f, *b);
37   }
39 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" { xfail *-*-* } } } */
40 /* { dg-final { cleanup-ipa-dump "inline" } } */
41 /* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 1 "cp"  } } */
42 /* { dg-final { cleanup-ipa-dump "cp" } } */