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

#include <stdarg.h>

int
foo (int a, ...)
{
  int b = 0, c = 0;
  va_list ap;
  va_start (ap, a);
  if (a > 1)
    b = va_arg (ap, double);
  if (a > 2)
    c = va_arg (ap, long long);
  va_end (ap);
  return a + b + c;
}

/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */
/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { powerpc*-*-darwin* powerpc*-*-aix* } } } } */
/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { powerpc*-*-linux* && lp64 } } } } */