summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/va-arg-5.c
blob: 3d8b1a79ad11a3d54c94dfed2cca060ec6b9aa72 (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
#include <stdarg.h>

va_double (int n, ...)
{
  va_list args;

  va_start (args, n);

  if (va_arg (args, double) != 3.141592)
    abort ();
  if (va_arg (args, double) != 2.71827)
    abort ();
  if (va_arg (args, double) != 2.2360679)
    abort ();
  if (va_arg (args, double) != 2.1474836)
    abort ();

  va_end (args);
}

va_long_double (int n, ...)
{
  va_list args;

  va_start (args, n);

  if (va_arg (args, long double) != 3.141592L)
    abort ();
  if (va_arg (args, long double) != 2.71827L)
    abort ();
  if (va_arg (args, long double) != 2.2360679L)
    abort ();
  if (va_arg (args, long double) != 2.1474836L)
    abort ();

  va_end (args);
}

main ()
{
  va_double (4, 3.141592, 2.71827, 2.2360679, 2.1474836);
  va_long_double (4, 3.141592L, 2.71827L, 2.2360679L, 2.1474836L);
  exit (0);
}