1 /* { dg-do run } */
2 /* { dg-options "-std=gnu99 -O0" } */
3 
4 /* C99 6.5.17: Comma operator.
5    Test with fixed-point operands.
6    Based on the test from ../dfp/.  */
7 
8 extern void abort (void);
9 
10 #define FUNC(TYPE,NAME,PF) \
11 volatile TYPE NAME ## a, NAME ## b, NAME ## c; \
12 void \
13 init_ ## NAME () \
14 { \
15   NAME ## b = 0.2 ## PF; \
16   NAME ## c = 0.3 ## PF; \
17 }
18 
FUNC(short _Fract,sf,hr)19 FUNC (short _Fract, sf, hr)
20 FUNC (_Fract, f, r)
21 FUNC (long _Fract, lf, lr)
22 FUNC (long long _Fract, llf, llr)
23 FUNC (unsigned short _Fract, usf, uhr)
24 FUNC (unsigned _Fract, uf, ur)
25 FUNC (unsigned long _Fract, ulf, ulr)
26 FUNC (long long _Fract, ullf, ullr)
27 FUNC (_Sat short _Fract, Ssf, hr)
28 FUNC (_Sat _Fract, Sf, r)
29 FUNC (_Sat long _Fract, Slf, lr)
30 FUNC (_Sat long long _Fract, Sllf, llr)
31 FUNC (_Sat unsigned short _Fract, Susf, uhr)
32 FUNC (_Sat unsigned _Fract, Suf, ur)
33 FUNC (_Sat unsigned long _Fract, Sulf, ulr)
34 FUNC (_Sat long long _Fract, Sullf, ullr)
35 FUNC (short _Accum, sa, hk)
36 FUNC (_Accum, a, k)
37 FUNC (long _Accum, la, lk)
38 FUNC (long long _Accum, lla, llk)
39 FUNC (unsigned short _Accum, usa, uhk)
40 FUNC (unsigned _Accum, ua, uk)
41 FUNC (unsigned long _Accum, ula, ulk)
42 FUNC (long long _Accum, ulla, ullk)
43 FUNC (_Sat short _Accum, Ssa, hk)
44 FUNC (_Sat _Accum, Sa, k)
45 FUNC (_Sat long _Accum, Sla, lk)
46 FUNC (_Sat long long _Accum, Slla, llk)
47 FUNC (_Sat unsigned short _Accum, Susa, uhk)
48 FUNC (_Sat unsigned _Accum, Sua, uk)
49 FUNC (_Sat unsigned long _Accum, Sula, ulk)
50 FUNC (_Sat long long _Accum, Sulla, ullk)
51 
52 int
53 main ()
54 {
55 #define TEST(NAME) \
56   init_ ## NAME (); \
57   NAME ## a = (NAME ## b, NAME ## c); \
58   if (NAME ## a != NAME ## c) \
59     abort (); \
60   NAME ## a = (NAME ## c, 123, NAME ## b); \
61   if (NAME ## a != NAME ## b) \
62     abort ();
63 
64   TEST(sf)
65   TEST(f)
66   TEST(lf)
67   TEST(llf)
68   TEST(usf)
69   TEST(uf)
70   TEST(ulf)
71   TEST(ullf)
72   TEST(Ssf)
73   TEST(Sf)
74   TEST(Slf)
75   TEST(Sllf)
76   TEST(Susf)
77   TEST(Suf)
78   TEST(Sulf)
79   TEST(Sullf)
80   TEST(sa)
81   TEST(a)
82   TEST(la)
83   TEST(lla)
84   TEST(usa)
85   TEST(ua)
86   TEST(ula)
87   TEST(ulla)
88   TEST(Ssa)
89   TEST(Sa)
90   TEST(Sla)
91   TEST(Slla)
92   TEST(Susa)
93   TEST(Sua)
94   TEST(Sula)
95   TEST(Sulla)
96 
97   return 0;
98 }
99