summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
blob: 074f44a6d68468ca0d786e64c66d14f367373748 (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
32
/* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fno-tree-sra -fdump-ipa-pta-details" } */

struct X {
    int i;
    void *p;
};

static void * __attribute__((noinline,noclone))
foo(struct X *q, void *p)
{
  struct X b;
  b.p = p;
  *q = b;
  return q->p;
}
extern void abort (void);
int main()
{
  struct X a, c;
  void *p;
  a.p = (void *)&c;
  p = foo(&a, &a);
  /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta" { xfail *-*-* } } } */
  /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* a\[^ \]* c\[^ \]* }" "pta" } } */
  ((struct X *)p)->p = (void *)0;
  if (a.p != (void *)0)
    abort ();
  return 0;
}

/* { dg-final { cleanup-ipa-dump "pta" } } */