summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/alias-6.c
blob: bcc011898faba07c997a9aa3e0c4a97212a338de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

struct param { int *a; };
void foo(struct param *p);
int bar(void)
{
  int a[2];
  struct param p;
  a[0] = 1;
  a[1] = 1;
  p.a = &a[0];
  foo(&p);
  return a[0] + *p.a;
}

/* We need to have both: a load from "a[0]" and a load from "*p.a",
   the latter can be an ssa temporary.  */
/* { dg-final { scan-tree-dump "= a.0.;" "optimized" } } */
/* { dg-final { scan-tree-dump "= \\*\[pD\]" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */