aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr49161.c
blob: cc822dae8c3cde3bf0b235da1c8b191a5e271d3f (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
45
46
/* PR tree-optimization/49161 */

extern void abort (void);

int c;

__attribute__((noinline, noclone)) void
bar (int x)
{
  if (x != c++)
    abort ();
}

__attribute__((noinline, noclone)) void
foo (int x)
{
  switch (x)
    {
    case 3: goto l1;
    case 4: goto l2;
    case 6: goto l3;
    default: return;
    }
l1:
  goto l4;
l2:
  goto l4;
l3:
  bar (-1);
l4:
  bar (0);
  if (x != 4)
    bar (1);
  if (x != 3)
    bar (-1);
  bar (2);
}

int
main ()
{
  foo (3);
  if (c != 3)
    abort ();
  return 0;
}