Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / gcc.dg / pr42715.c
blob72bdfc86244f78d41b8168854253e2b92d1ec8b1
1 /* { dg-do compile { target fpic } } */
2 /* { dg-options "-fPIC -g -O2 -w" } */
3 /* var-tracking failed to clobber the reg holding v at the asm insn,
4 so v ended up bound to an intermediate PIC expression. */
6 struct A { unsigned a1; char a2[15]; };
7 struct B { long b1; unsigned char b2; long b3; };
8 struct C { void *c1; unsigned c2; unsigned c3; };
10 static struct A v1;
11 struct A *const v2 = &v1;
13 static inline
14 int foo (void)
16 int *v;
17 __asm__ __volatile__ ("" : "=r" (v));
18 return v[1];
21 static void
22 bar (struct C *x)
24 if (x->c2 == x->c3 && x->c1)
25 f1 (foo (), x->c1, x->c3 * sizeof (x->c1[0]));
28 void
29 baz (struct B *y)
31 int i;
32 const char *j;
33 char *k;
34 char x[64];
35 for (i = 0; i < sizeof (struct B); i++, y)
37 switch (y->b2)
39 case 0x20:
40 if (__builtin_strchr (j, '='))
41 continue;
43 switch (y->b2)
45 case 0x80:
46 bar (&x);
47 f2 (y->b3);
48 case 0x2e:
49 case 0x4e:
50 break;
51 default:
52 if (v2->a1)
53 f2 (y->b2);
55 k[0] = '\0';
56 if (v2->a1)
57 f2 (y->b1);