summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr38236.c
blob: d781542c7ccab5590b7ff1885ad4889aa215d1f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
struct X { int i; };

int __attribute__((noinline))
foo (struct X *p, int *q, int a, int b)
{
  struct X x, y;
  if (a)
    p = &x;
  if (b)
    q = &x.i;
  else
    q = &y.i;
  *q = 1;
  return p->i; 
}
extern void abort (void);
int main()
{
  if (foo((void *)0, (void *)0, 1, 1) != 1)
    abort ();
  return 0;
}