summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr49651.c
blob: c58fe943c83103bca0d8cbd5e0d285fc75bce872 (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
/* { dg-do run } */

extern void abort (void);

struct X {
    int *p;
    int *q;
};

void __attribute__((noinline, noclone))
foo (struct X x) { *x.q = 0; }

volatile int what;
struct X y;

int main()
{
  int i, j;
  struct X x, *p;
  x.p = &i;
  x.q = &j;
  if (what)
    p = &y;
  else
    p = &x;
  j = 1;
  foo (*p);
  if (j != 0)
    abort ();
  return 0;
}