2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr61757.c
blob9a921a06ca8165502187d9e4f7997751d9374d1f
1 /* { dg-do run } */
3 extern void abort (void);
5 struct X { void *p; int res; } a[32];
7 int foo (unsigned i, unsigned n, void *q)
9 if (i + 1 < n && q == a[i + 1].p)
11 do {
12 ++i;
13 } while (i < n && q == a[i].p);
14 --i;
15 return a[i].res;
17 else
18 return a[i].res;
21 int main ()
23 int x;
24 a[0].p = &x;
25 a[0].res = -1;
26 a[1].p = &x;
27 a[1].res = 1;
28 a[2].p = (void *)0;
29 a[2].res = 0;
30 if (foo (0, 3, &x) != 1)
31 abort ();
32 return 0;