summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/guality/pr43329-1.c
blob: 5e27adfca30b314544d2f079f4cfff9b4ffe54db (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
49
50
51
52
/* PR debug/43329 */
/* { dg-do run } */
/* { dg-options "-g" } */

#include "../nop.h"

static inline void
foo (int argx)
{
  int varx = argx;
  __asm__ volatile (NOP);			/* { dg-final { gdb-test 12 "argx" "25" } } */
  __asm__ volatile (NOP : : "g" (varx));	/* { dg-final { gdb-test 12 "varx" "25" } } */
}

int i;

__attribute__((noinline))
void baz (int x)
{
  asm volatile ("" : : "r" (x) : "memory");
}

static inline void
bar (void)
{
  foo (25);
  i = i + 2;
  i = i * 2;
  i = i - 4;
  baz (i);
  i = i * 2;
  i = i >> 1;
  i = i << 6;
  baz (i);
  i = i + 2;
  i = i * 2;
  i = i - 4;
  baz (i);
  i = i * 2;
  i = i >> 6;
  i = i << 1;
  baz (i);
}

int
main (void)
{
  __asm__ volatile ("" : "=r" (i) : "0" (0));
  bar ();
  bar ();
  return i;
}