aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr42715.c
blob: 72bdfc86244f78d41b8168854253e2b92d1ec8b1 (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
53
54
55
56
57
58
59
/* { dg-do compile { target fpic } } */
/* { dg-options "-fPIC -g -O2 -w" } */
/* var-tracking failed to clobber the reg holding v at the asm insn,
   so v ended up bound to an intermediate PIC expression.  */

struct A { unsigned a1; char a2[15]; };
struct B { long b1; unsigned char b2; long b3; };
struct C { void *c1; unsigned c2; unsigned c3; };

static struct A v1;
struct A *const v2 = &v1;

static inline
int foo (void)
{
  int *v;
  __asm__ __volatile__ ("" : "=r" (v));
  return v[1];
}

static void
bar (struct C *x)
{
  if (x->c2 == x->c3 && x->c1)
    f1 (foo (), x->c1, x->c3 * sizeof (x->c1[0]));
}

void
baz (struct B *y)
{
  int i;
  const char *j;
  char *k;
  char x[64];
  for (i = 0; i < sizeof (struct B); i++, y)
    {
      switch (y->b2)
        {
        case 0x20:
          if (__builtin_strchr (j, '='))
            continue;
        }
      switch (y->b2)
        {
        case 0x80:
          bar (&x);
          f2 (y->b3);
        case 0x2e:
        case 0x4e:
          break;
        default:
          if (v2->a1)
            f2 (y->b2);
        }
      k[0] = '\0';
      if (v2->a1)
        f2 (y->b1);
    }
}