summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ipa/ipa-icf-6.C
blob: 933ab5dcf08b39c1ad5848f3a000e38020ebd166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* { dg-do run } */
/* { dg-options "-O3 -fdump-ipa-icf"  } */

struct A {                                                                      
  A() {ptr=&b;}                                                                 
  A(const A &a) {ptr = &b;}                                                     
  void test() { if (ptr != &b) __builtin_abort ();}                             
  int b;                                                                        
  int *ptr;                                                                     
};                                                                              

A test1(A a)
{
  a.test();
  return a;
}
A test2(A a)
{
  a.test();
  return a;
}
__attribute__ ((noinline))
static void
test_me (A (*t)(A))
{
  struct A a, b=t(a);
  b.test ();
}
int
main()
{
  test_me (test1);
  test_me (test2);
  return 0;
}
/* { dg-final { scan-ipa-dump-times "Unified; Wrapper has been created" 1 "icf"  } } */
/* { dg-final { cleanup-ipa-dump "icf" } } */