1/* { dg-do compile } */ 2/* { dg-options "-O2 -fdump-ipa-icf-details" } */ 3 4struct __hlist_head 5{ 6 struct __hlist_node *first; 7}; 8 9struct __hlist_node 10{ 11 struct __hlist_node *next, **pprev; 12}; 13 14struct __net 15{ 16 int ifindex; 17 struct __hlist_head * dev_index_head; 18}; 19 20struct __net_device 21{ 22 int ifindex; 23 struct __net *nd_net; 24 struct __hlist_node index_hlist; 25}; 26 27__attribute__ ((noinline, noclone)) 28static struct __hlist_head * __dev_index_hash(struct __net *net, 29 int ifindex) 30{ 31 return &net->dev_index_head[ifindex & 1]; 32} 33 34__attribute__ ((noinline, noclone)) 35struct __net_device * __dev_get_by_index(struct __net *net, int ifindex) 36{ 37 struct __net_device * dev; 38 struct __hlist_head * head = __dev_index_hash(net, ifindex); 39 40 for (dev = ( { typeof((head)->first) ____ptr = ((head)->first); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}): ((void *) 0);}); 41 dev; dev = ( { typeof ((dev)->index_hlist.next) ____ptr = ((dev)->index_hlist.next); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}): ((void *) 0);})) 42 if (dev->ifindex == ifindex) 43 return dev; 44 45 return ((void *)0); 46} 47 48__attribute__ ((noinline, noclone)) 49struct __net_device * dev_get_by_index_rcu(struct __net *net, int ifindex) 50{ 51 struct __net_device * dev; 52 struct __hlist_head * head = __dev_index_hash(net, ifindex); 53 54 for (dev = ( { typeof(( { typeof (* ((*((struct __hlist_node **)(&(head)->first))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(head)->first))))) *)&(((*((struct __hlist_node **)(&(head)->first)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (_________p1));})) ____ptr = (( { typeof (* ((*((struct __hlist_node **)(&(head)->first))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(head)->first))))) *)&(((*((struct __hlist_node **)(&(head)->first)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (_________p1));})); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}):((void *) 0);}); 55 dev; dev = ( { typeof(( { typeof (* ((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *)&(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (_________p1));})) ____ptr = (( { typeof (* ((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *)&(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (_________p1));})); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}): ((void *) 0);})) 56 if (dev->ifindex == ifindex) 57 return dev; 58 return ((void *)0); 59} 60 61__attribute__ ((noinline, noclone)) 62int foo(struct __net *net) 63{ 64 if (!__dev_get_by_index(net, net->ifindex)); 65 return 1; 66 return 0; 67} 68 69int main() 70{ 71 return 0; 72} 73 74/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */ 75/* { dg-final { cleanup-ipa-dump "icf" } } */ 76