1/* { dg-do compile } */
2/* { dg-options "-O2 -fdump-tree-pre" } */
3
4typedef struct {
5    unsigned int key;
6} S;
7typedef struct s1  {
8    unsigned int key;
9    unsigned int bits;
10    struct s1 *left, *right;
11}S1;
12extern S a[1024];
13static inline int bar( S* p, S1* n )
14{
15  S1 *curr;
16  S1 *next;
17
18  if ( n->left == n )
19    return (int)(p->key == n->key);
20
21  curr = n;
22  next = n->left;
23
24  while (curr->bits > next->bits ) {
25      curr = next;
26      if (p->key & (1 << curr->bits))
27	next = curr->right;
28      else
29	next = curr->left;
30  }
31
32  return (int)(p->key == next->key);
33
34}
35
36int foo (S1 *root, int N)
37{
38  volatile int r;
39  int i,j;
40  for (i=0; i<N; i++)
41    for (j=0;j<1024; j++)
42      r = bar(&a[j], root);
43  return 0;
44}
45
46/* { dg-final { scan-tree-dump-times "key" 4 "pre" } } */
47/* { dg-final { cleanup-tree-dump "pre" } } */
48