1 /* { dg-do compile } */
2 /* { dg-options "-std=gnu99" } */
3 
4 /* C99 6.3 Conversions.
5 
6    Check if all conversions are ok.  */
7 
8 #define CONV(TYPE, NAME) \
9         float NAME ## _to_SF (TYPE a) { return a; } \
10         float Sat ## NAME ## _to_SF (_Sat TYPE a) { return a; } \
11         double NAME ## _to_DF (TYPE a) { return a; } \
12         double Sat ## NAME ## _to_DF (_Sat TYPE a) { return a; } \
13         TYPE SF_to_ ## NAME (float a) { return a; } \
14         _Sat TYPE SF_to_Sat ## NAME (float a) { return a; } \
15         TYPE DF_to_ ## NAME (double a) { return a; } \
16         _Sat TYPE DF_to_Sat ## NAME (double a) { return a; } \
17         signed char NAME ## _to_schar (TYPE a) { return a; } \
18         signed char Sat ## NAME ## _to_schar (_Sat TYPE a) { return a; } \
19         unsigned char NAME ## _to_uchar (TYPE a) { return a; } \
20         unsigned char Sat ## NAME ## _to_uchar (_Sat TYPE a) { return a; } \
21         short NAME ## _to_short (TYPE a) { return a; } \
22         short _Sat ## NAME ## _to_short (_Sat TYPE a) { return a; } \
23         unsigned short NAME ## _to_ushort (TYPE a) { return a; } \
24         unsigned short _Sat ## NAME ## _to_ushort (_Sat TYPE a) { return a; } \
25         int NAME ## _to_int (TYPE a) { return a; } \
26         int _Sat ## NAME ## _to_int (_Sat TYPE a) { return a; } \
27         unsigned int NAME ## _to_uint (TYPE a) { return a; } \
28         unsigned int _Sat ## NAME ## _to_uint (_Sat TYPE a) { return a; } \
29         long NAME ## _to_long (TYPE a) { return a; } \
30         unsigned long NAME ## _to_ulong (TYPE a) { return a; } \
31         long _Sat ## NAME ## _to_long (TYPE a) { return a; } \
32         unsigned long _Sat ## NAME ## _to_ulong (TYPE a) { return a; } \
33         long long NAME ## _to_longlong (TYPE a) { return a; } \
34         long long _Sat ## NAME ## _to_longlong (TYPE a) { return a; } \
35         unsigned long long NAME ## _to_ulonglong (TYPE a) { return a; } \
36         unsigned long long _Sat ## NAME ## _to_ulonglong (TYPE a) { return a; } \
37         TYPE schar_to_ ## NAME (signed char a) { return a; } \
38         _Sat TYPE schar_to_Sat ## NAME (signed char a) { return a; } \
39         TYPE uchar_to_ ## NAME (unsigned char a) { return a; } \
40         _Sat TYPE uchar_to_Sat ## NAME (unsigned char a) { return a; } \
41         TYPE short_to_ ## NAME (short a) { return a; } \
42         TYPE ushort_to_ ## NAME (unsigned short a) { return a; } \
43         TYPE int_to_ ## NAME (int a) { return a; } \
44         TYPE uint_to_ ## NAME (unsigned int a) { return a; } \
45         TYPE long_to_ ## NAME (long a) { return a; } \
46         TYPE ulong_to_ ## NAME (unsigned long a) { return a; } \
47         TYPE longlong_to_ ## NAME (long long a) { return a; } \
48         TYPE ulonglong_to_ ## NAME (unsigned long long a) { return a; } \
49         _Sat TYPE short_to_Sat ## NAME (short a) { return a; } \
50         _Sat TYPE ushort_to_Sat ## NAME (unsigned short a) { return a; } \
51         _Sat TYPE int_to_Sat ## NAME (int a) { return a; } \
52         _Sat TYPE uint_to_Sat ## NAME (unsigned int a) { return a; } \
53         _Sat TYPE long_to_Sat ## NAME (long a) { return a; } \
54         _Sat TYPE ulong_to_Sat ## NAME (unsigned long a) { return a; } \
55         _Sat TYPE longlong_to_Sat ## NAME (long long a) { return a; } \
56         _Sat TYPE ulonglong_to_Sat ## NAME (unsigned long long a) { return a; } \
57 	TYPE SFR_to ## NAME (short _Fract a) { return a; } \
58 	TYPE FR_to ## NAME (_Fract a) { return a; } \
59 	TYPE LFR_to ## NAME (long _Fract a) { return a; } \
60 	TYPE LLFR_to ## NAME (long long _Fract a) { return a; } \
61 	TYPE USFR_to ## NAME (unsigned short _Fract a) { return a; } \
62 	TYPE UFR_to ## NAME (unsigned _Fract a) { return a; } \
63 	TYPE ULFR_to ## NAME (unsigned long _Fract a) { return a; } \
64 	TYPE ULLFR_to ## NAME (unsigned long long _Fract a) { return a; } \
65 	TYPE SAC_to ## NAME (short _Accum a) { return a; } \
66 	TYPE AC_to ## NAME (_Accum a) { return a; } \
67 	TYPE LAC_to ## NAME (long _Accum a) { return a; } \
68 	TYPE LLAC_to ## NAME (long long _Accum a) { return a; } \
69 	TYPE USAC_to ## NAME (unsigned short _Accum a) { return a; } \
70 	TYPE UAC_to ## NAME (unsigned _Accum a) { return a; } \
71 	TYPE ULAC_to ## NAME (unsigned long _Accum a) { return a; } \
72 	TYPE ULLAC_to ## NAME (unsigned long long _Accum a) { return a; } \
73 	TYPE SATSFR_to ## NAME (_Sat short _Fract a) { return a; } \
74 	TYPE SATFR_to ## NAME (_Sat _Fract a) { return a; } \
75 	TYPE SATLFR_to ## NAME (_Sat long _Fract a) { return a; } \
76 	TYPE SATLLFR_to ## NAME (_Sat long long _Fract a) { return a; } \
77 	TYPE SATUSFR_to ## NAME (_Sat unsigned short _Fract a) { return a; } \
78 	TYPE SATUFR_to ## NAME (_Sat unsigned _Fract a) { return a; } \
79 	TYPE SATULFR_to ## NAME (_Sat unsigned long _Fract a) { return a; } \
80 	TYPE SATULLFR_to ## NAME (_Sat unsigned long long _Fract a) { return a; } \
81 	TYPE SATSAC_to ## NAME (_Sat short _Accum a) { return a; } \
82 	TYPE SATAC_to ## NAME (_Sat _Accum a) { return a; } \
83 	TYPE SATLAC_to ## NAME (_Sat long _Accum a) { return a; } \
84 	TYPE SATLLAC_to ## NAME (_Sat long long _Accum a) { return a; } \
85 	TYPE SATUSAC_to ## NAME (_Sat unsigned short _Accum a) { return a; } \
86 	TYPE SATUAC_to ## NAME (_Sat unsigned _Accum a) { return a; } \
87 	TYPE SATULAC_to ## NAME (_Sat unsigned long _Accum a) { return a; } \
88 	TYPE SATULLAC_to ## NAME (_Sat unsigned long long _Accum a) { return a; } \
89 	_Sat TYPE SFR_to_SAT ## NAME (short _Fract a) { return a; } \
90 	_Sat TYPE FR_to_SAT ## NAME (_Fract a) { return a; } \
91 	_Sat TYPE LFR_to_SAT ## NAME (long _Fract a) { return a; } \
92 	_Sat TYPE LLFR_to_SAT ## NAME (long long _Fract a) { return a; } \
93 	_Sat TYPE USFR_to_SAT ## NAME (unsigned short _Fract a) { return a; } \
94 	_Sat TYPE UFR_to_SAT ## NAME (unsigned _Fract a) { return a; } \
95 	_Sat TYPE ULFR_to_SAT ## NAME (unsigned long _Fract a) { return a; } \
96 	_Sat TYPE ULLFR_to_SAT ## NAME (unsigned long long _Fract a) { return a; } \
97 	_Sat TYPE SAC_to_SAT ## NAME (short _Accum a) { return a; } \
98 	_Sat TYPE AC_to_SAT ## NAME (_Accum a) { return a; } \
99 	_Sat TYPE LAC_to_SAT ## NAME (long _Accum a) { return a; } \
100 	_Sat TYPE LLAC_to_SAT ## NAME (long long _Accum a) { return a; } \
101 	_Sat TYPE USAC_to_SAT ## NAME (unsigned short _Accum a) { return a; } \
102 	_Sat TYPE UAC_to_SAT ## NAME (unsigned _Accum a) { return a; } \
103 	_Sat TYPE ULAC_to_SAT ## NAME (unsigned long _Accum a) { return a; } \
104 	_Sat TYPE ULLAC_to_SAT ## NAME (unsigned long long _Accum a) { return a; } \
105 	_Sat TYPE SATSFR_to_SAT ## NAME (_Sat short _Fract a) { return a; } \
106 	_Sat TYPE SATFR_to_SAT ## NAME (_Sat _Fract a) { return a; } \
107 	_Sat TYPE SATLFR_to_SAT ## NAME (_Sat long _Fract a) { return a; } \
108 	_Sat TYPE SATLLFR_to_SAT ## NAME (_Sat long long _Fract a) { return a; } \
109 	_Sat TYPE SATUSFR_to_SAT ## NAME (_Sat unsigned short _Fract a) { return a; } \
110 	_Sat TYPE SATUFR_to_SAT ## NAME (_Sat unsigned _Fract a) { return a; } \
111 	_Sat TYPE SATULFR_to_SAT ## NAME (_Sat unsigned long _Fract a) { return a; } \
112 	_Sat TYPE SATULLFR_to_SAT ## NAME (_Sat unsigned long long _Fract a) { return a; } \
113 	_Sat TYPE SATSAC_to_SAT ## NAME (_Sat short _Accum a) { return a; } \
114 	_Sat TYPE SATAC_to_SAT ## NAME (_Sat _Accum a) { return a; } \
115 	_Sat TYPE SATLAC_to_SAT ## NAME (_Sat long _Accum a) { return a; } \
116 	_Sat TYPE SATLLAC_to_SAT ## NAME (_Sat long long _Accum a) { return a; } \
117 	_Sat TYPE SATUSAC_to_SAT ## NAME (_Sat unsigned short _Accum a) { return a; } \
118 	_Sat TYPE SATUAC_to_SAT ## NAME (_Sat unsigned _Accum a) { return a; } \
119 	_Sat TYPE SATULAC_to_SAT ## NAME (_Sat unsigned long _Accum a) { return a; } \
120 	_Sat TYPE SATULLAC_to_SAT ## NAME (_Sat unsigned long long _Accum a) { return a; } \
121 	_Complex int NAME ## _to_CI (TYPE a) { return a; } \
122 	_Complex unsigned int NAME ## _to_CUI (TYPE a) { return a; } \
123 	_Complex float NAME ## _to_CF (TYPE a) { return a; } \
124 	_Complex double NAME ## _to_CD (TYPE a) { return a; } \
125 	TYPE CI_to_ ## NAME (_Complex int a) { return a; } \
126 	TYPE CUI_to_ ## NAME (_Complex unsigned int a) { return a; } \
127 	TYPE CF_to_ ## NAME (_Complex float a) { return a; } \
128 	TYPE CD_to_ ## NAME (_Complex double a) { return a; } \
129 	_Sat TYPE CI_to_SAT ## NAME (_Complex int a) { return a; } \
130 	_Sat TYPE CUI_to_SAT ## NAME (_Complex unsigned int a) { return a; } \
131 	_Sat TYPE CF_to_SAT ## NAME (_Complex float a) { return a; } \
132 	_Sat TYPE CD_to_SAT ## NAME (_Complex double a) { return a; }
133 
134 CONV(short _Fract, sf);
135 CONV(_Fract, f);
136 CONV(long _Fract, lf);
137 CONV(long long _Fract, llf);
138 CONV(unsigned short _Fract, usf);
139 CONV(unsigned _Fract, uf);
140 CONV(unsigned long _Fract, ulf);
141 CONV(unsigned long long _Fract, ullf);
142 
143 CONV(short _Accum, sk);
144 CONV(_Accum, k);
145 CONV(long _Accum, lk);
146 CONV(long long _Accum, llk);
147 CONV(unsigned short _Accum, usk);
148 CONV(unsigned _Accum, uk);
149 CONV(unsigned long _Accum, ulk);
150 CONV(unsigned long long _Accum, ullk);
151