aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/alias-28.c
blob: 8413230eaf46e61b71aaeb8f1d7d6e0c55c40112 (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
/* { dg-do run } */
/* { dg-options "-O3" } */

extern void abort (void);
extern void *malloc(__SIZE_TYPE__);

int * __attribute__((noinline,noclone))
foo (int *p)
{
  int *q = (int *) malloc (sizeof (int));
  *p = 1;
  *q = 2;
  if (*p != 1)
    __link_error ();
  *p = 3;
  return q;
}

int main()
{
  int i;
  int *p = foo (&i);
  if (i != 3 || *p != 2)
    abort ();
  return 0;
}