aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/restrict-8.c
blob: 0118de0133c84d6bbad8c9aa91b256cbed039dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
/* { dg-options "-fdump-tree-fre1" } */

struct S { int i; void *p; int j; };
int
foo (struct S * __restrict p, int *q, int flag)
{
  int *x = &p->j;
  if (flag)
    x = &p->i;
  *q = 1;
  *x = 2;
  return *q;
}

/* { dg-final { scan-tree-dump "return 1;" "fre1" } } */