aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr97627.C
blob: 81466dc3b81adc8b29b3a9e1ec17f439996dd5c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* PR tree-optimization/97627.  */
/* { dg-do run } */

struct S { unsigned short x, y; } m = { 1, 0 };

__attribute__((noipa)) void
baz (int x, int y)
{
  if (x != 0 || y != 1)
    __builtin_abort ();
}

__attribute__((noipa)) void
bar ()
{
  throw 1;
}

void
foo ()
{
  while (1)
    {
      int a = m.x + 1;
      int b = m.y + 1;
      for (int c = 0; c < a; c++)
	for (int d = 0; d < b; d++)
	  baz (d, b);
      bar ();
    }
}

int
main ()
{
  try
    {
      foo ();
    }
  catch (int)
    {
    }
  return 0;
}