1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-ipa-icf" } */
3 static int a;
4 static int b;
5 static const int c = 2;
6 static const int d = 2;
7 static char * e = "test";
8 static char * f = "test";
9 static int g[3]={1,2,3};
10 static int h[3]={1,2,3};
11 static const int *i=&c;
12 static const int *j=&c;
13 static const int *k=&d;
t(int tt)14 int t(int tt)
15 {
16 switch (tt)
17 {
18 case 1: return a;
19 case 2: return b;
20 case 3: return c;
21 case 4: return d;
22 case 5: return e[1];
23 case 6: return f[1];
24 case 7: return g[1];
25 case 8: return h[1];
26 case 9: return i[0];
27 case 10: return j[0];
28 case 11: return k[0];
29 }
30 }
31 /* { dg-final { scan-ipa-dump "Equal symbols: 5" "icf" } } */
32 /* { dg-final { scan-ipa-dump "Semantic equality hit:a->b" "icf" } } */
33 /* { dg-final { scan-ipa-dump "Semantic equality hit:c->d" "icf" } } */
34 /* { dg-final { scan-ipa-dump "Semantic equality hit:e->f" "icf" } } */
35 /* { dg-final { scan-ipa-dump "Semantic equality hit:g->h" "icf" } } */
36 /* { dg-final { scan-ipa-dump "Semantic equality hit:i->j" "icf" } } */
37