summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-va-arg-13.c
blob: fc21ac76439b23a22ac2ed3d933a0f4e0b813566 (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
38
39
40
41
42
43
44
45
46
47
/*
va-arg-13.c from the execute part of the gcc torture tests.
*/

#include <testfwk.h>

/* derived from mozilla source code */

#include <stdarg.h>

typedef struct {
  void *stream;
  va_list ap;
  int nChar;  
} ScanfState;

void dummy (va_list vap)
{
  if (va_arg (vap, int) != 1234) ASSERT(0);
  return;
}

void test (int fmt, ...)
{
  ScanfState state, *statep;

  statep = &state;

  va_start (statep->ap, fmt);
  dummy (statep->ap);
  va_end (statep->ap);
  
  va_start (state.ap, fmt);
  dummy (state.ap);
  va_end (state.ap);
  
  return;
}

void
testTortureExecute (void)
{
#ifndef __SDCC_ds390 // Bug #2779
  test (456, 1234);
  return;
#endif
}