aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/gcc.dg/guality/pr54519-1.c
blob: 98afd45c18f8ddb0f6604ff4983db03a8a6ca3f6 (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
47
48
/* PR debug/54519 */
/* { dg-do run } */
/* { dg-options "-g" } */

__attribute__((noinline, noclone)) void
fn1 (int x)
{
  __asm volatile ("" : "+r" (x) : : "memory");
}

static int
fn2 (int x, int y, int z)
{
  int a = 8;
  if (x != z)
    {
      fn1 (x);
      fn1 (x);		/* { dg-final { gdb-test 20 "x" "36" } } */
      if (x == 36)	/* { dg-final { gdb-test 20 "y" "25" } } */
	fn1 (x);	/* { dg-final { gdb-test 20 "z" "6" } } */
      fn1 (x);		/* { dg-final { gdb-test 23 "x" "98" } } */
      if (x == 98)	/* { dg-final { gdb-test 23 "y" "117" } } */
	fn1 (x);	/* { dg-final { gdb-test 23 "z" "8" } } */
      fn1 (x);
      fn1 (x + a);
    }
  return y;
}

__attribute__((noinline, noclone)) int
fn3 (int x, int y)
{
  return fn2 (x, y, 6);
}

__attribute__((noinline, noclone)) int
fn4 (int x, int y)
{
  return fn2 (x, y, 8);
}

int
main ()
{
  fn3 (36, 25);
  fn4 (98, 117);
  return 0;
}