aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr101170.c
blob: fc8106206b6db6a1b83df3236f5ffb62cca256ba (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
33
34
35
36
37
/* PR middle-end/101170 */
/* { dg-do compile } */
/* { dg-options "-O2 -g" } */

#include <stdarg.h>

struct S { int a; int b[4]; } s;
va_list ap;
int i;
long long l;

struct S
foo (int x)
{
  struct S a = {};
  do
    if (x)
      return a;
  while (1);
}

__attribute__((noipa)) void
bar (void)
{
  for (; i; i++)
    l |= va_arg (ap, long long) << s.b[i];
  if (l)
    foo (l);
}

void
baz (int v, ...)
{
  va_start (ap, v);
  bar ();
  va_end (ap);
}