Reset branch to trunk.
[official-gcc.git] / trunk / gcc / testsuite / gcc.dg / debug / vta-1.c
blob414083a09c019702636585142b6422c62e225d08
1 /* https://bugzilla.redhat.com/show_bug.cgi?id=521991#c5
3 Distilled from Linux XFS source code. foo, inlined into bar, ends
4 up with debug stmts referencing the addressable variable b.
5 Optimization made it non-addressable, and then completely optimized
6 away, before we got a chance to rename (and discard) the occurrence
7 in the debug stmt. When we did, we crashed, attempting to rename
8 an unreference variable. */
10 /* { dg-do compile } */
12 static inline int
13 foo (void *x, unsigned y)
15 unsigned z = *(unsigned long *) x % y;
16 *(unsigned long *) x = *(unsigned long *) x / y;
17 return z;
20 struct S
22 unsigned t;
25 void
26 bar (struct S *x, int *y)
28 int a = 0;
29 unsigned long b = x->t;
30 foo (&b, x->t);
31 for (;; a++)
32 if (b)
33 *y = 1;