aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/avr/torture/pr61443.c
blob: 12c6bca6663ae5dc20526c99b012a7cac298c46b (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* { dg-do run } */
/* { dg-options "-std=gnu99" } */

#include <stdlib.h>
#include <stdarg.h>

#define NC __attribute__((noinline,noclone))

void NC vfun (char n, ...)
{
  va_list ap;

  va_start (ap, n);

  switch (n)
    {
    default:
      abort();
    case 1:
      if (11 != va_arg (ap, int))
        abort();
      break;
    case 2:
      if (2222 != va_arg (ap, int))
        abort();
      break;
    case 3:
      if (333333 != va_arg (ap, __int24))
        abort();
      break;
    case 4:
      if (44444444 != va_arg (ap, long))
        abort();
      break;
    case 8:
      if (8888888888888888 != va_arg (ap, long long))
        abort();
      break;
    }

  va_end (ap);
}


void NC boo_qi (const __flash char *p)
{
  vfun (1, *p);
}

void NC boox_qi (const __memx char *p)
{
  vfun (1, *p);
}

void NC boo_hi (const __flash int *p)
{
  vfun (2, *p);
}

void NC boox_hi (const __memx int *p)
{
  vfun (2, *p);
}

void NC boo_psi (const __flash __int24 *p)
{
  vfun (3, *p);
}

void NC boox_psi (const __memx __int24 *p)
{
  vfun (3, *p);
}

void NC boo_si (const __flash long *p)
{
  vfun (4, *p);
}

void NC boox_si (const __memx long *p)
{
  vfun (4, *p);
}

void NC boo_di (const __flash long long *p)
{
  vfun (8, *p);
}

void NC boox_di (const __memx long long *p)
{
  vfun (8, *p);
}

const __flash char f_qi = 11;
const __flash int f_hi = 2222;
const __flash __int24 f_psi = 333333;
const __flash long f_si = 44444444;
const __flash long long f_di = 8888888888888888;

const __memx char x_qi = 11;
const __memx int x_hi = 2222;
const __memx __int24 x_psi = 333333;
const __memx long x_si = 44444444;
const __memx long long x_di = 8888888888888888;

char r_qi = 11;
int r_hi = 2222;
__int24 r_psi = 333333;
long r_si = 44444444;
long long r_di = 8888888888888888;

int main (void)
{
  boo_qi (&f_qi);
  boo_hi (&f_hi);
  boo_psi (&f_psi);
  boo_si (&f_si);
  boo_di (&f_di);

  boox_qi (&x_qi);
  boox_hi (&x_hi);
  boox_psi (&x_psi);
  boox_si (&x_si);
  boox_di (&x_di);

  boox_qi (&r_qi);
  boox_hi (&r_hi);
  boox_psi (&r_psi);
  boox_si (&r_si);
  boox_di (&r_di);

  exit (0);
}