1// Verify that loop optimization takes into account the exception edge
2// and does not increment I before the call.
3// { dg-do run }
4// { dg-options "-O2" }
5
6extern "C" void abort();
7static void bar(char *);
8
9static void foo(unsigned long element_count, char *ptr)
10{
11  unsigned long i;
12  try {
13    for (i = 0; i != element_count; i++, ptr += 8)
14      bar (ptr);
15  }
16  catch (...) {
17    if (i)
18      abort ();
19  }
20}
21
22static void bar(char *)
23{
24  throw 1;
25}
26
27int main()
28{
29  foo(2, 0);
30}
31