summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-pta-10.c
blob: 81a3c53bdfdd9e2c66847955a14ed85ec42b6654 (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
/* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */

#include <stdarg.h>

static void __attribute__((noinline,noclone))
foo (int i, ...)
{
  va_list ap;
  int *p;
  va_start (ap, i);
  p = va_arg (ap, int *);
  *p = 1;
  va_end (ap);
}
extern void abort (void);
int main()
{
  int i = 0;
  foo (0, &i);
  if (i != 1)
    abort ();
  return 0;
}

/* Verify we properly handle variadic arguments and do not let escape
   stuff through it.  */

/* { dg-final { scan-ipa-dump "ESCAPED = { (ESCAPED )?(NONLOCAL )?}" "pta" } } */
/* { dg-final { cleanup-ipa-dump "pta" } } */