1/* { dg-do compile } */ 2/* { dg-options "-O2 -fdump-ipa-icf" } */ 3static int a; 4static int b; 5static const int c = 2; 6static const int d = 2; 7static char * e = "test"; 8static char * f = "test"; 9static int g[3]={1,2,3}; 10static int h[3]={1,2,3}; 11static const int *i=&c; 12static const int *j=&c; 13static const int *k=&d; 14int 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:b->a" "icf" } } */ 33/* { dg-final { scan-ipa-dump "Semantic equality hit:d->c" "icf" } } */ 34/* { dg-final { scan-ipa-dump "Semantic equality hit:f->e" "icf" } } */ 35/* { dg-final { scan-ipa-dump "Semantic equality hit:h->g" "icf" } } */ 36/* { dg-final { scan-ipa-dump "Semantic equality hit:j->i" "icf" } } */ 37/* { dg-final { cleanup-ipa-dump "icf" } } */ 38