view gcc/testsuite/gcc.dg/tree-ssa/alias-28.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-O3" } */

extern void abort (void);
extern void __link_error (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;
}