summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/guality/pr43177.c
blob: 563835b630a29ecb2e1ac614e90ad1345cb8a0e4 (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
/* { dg-do run } */
/* { dg-options "-g" } */

void __attribute__((noinline))
bar (long x)
{
  asm volatile ("" : : "r" (x) : "memory");
}

long __attribute__((noinline))
foo (long x)
{
  long l = x + 3;
  bar (l);/* { dg-final { gdb-test 15 "l" "10" } } */
  bar (l);/* { dg-final { gdb-test 15 "x" "7" } } */
  return l;
}

long __attribute__((noinline))
baz (int x)
{
  long l = x + 3;
  bar (l);/* { dg-final { gdb-test 24 "l" "10" } } */
  bar (l);/* { dg-final { gdb-test 24 "x" "7" } } */
  return l;
}

int
main (void)
{
  int i;
  asm volatile ("" : "=r" (i) : "0" (7));
  foo (i);
  baz (i);
  return 0;
}