1 |
689 |
jeremybenn |
/* { dg-do run } */
|
2 |
|
|
/* { dg-options "-std=gnu99" } */
|
3 |
|
|
|
4 |
|
|
/* C99 6.9.1(9) Function definitions; parameter has automatic storage.
|
5 |
|
|
|
6 |
|
|
Test that actual parameters are passed by value and that modifications
|
7 |
|
|
made within functions are lost on function return.
|
8 |
|
|
|
9 |
|
|
This test is copied from gcc.dg/dfp/ and changed for fixed-point types. */
|
10 |
|
|
|
11 |
|
|
extern void abort (void);
|
12 |
|
|
|
13 |
|
|
#define FOO_FUN(NAME,TYPE,VALUE) \
|
14 |
|
|
int foo ## NAME (TYPE z) \
|
15 |
|
|
{ \
|
16 |
|
|
z = z + VALUE; \
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
#define FOO_TEST(NAME,TYPE,VALUE) \
|
20 |
|
|
{ \
|
21 |
|
|
TYPE NAME = VALUE; \
|
22 |
|
|
foo ## NAME (NAME); \
|
23 |
|
|
if (NAME != VALUE) \
|
24 |
|
|
abort (); \
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
FOO_FUN (sf, short _Fract, 0.2hr)
|
28 |
|
|
FOO_FUN (f, _Fract, 0.2r)
|
29 |
|
|
FOO_FUN (lf, long _Fract, 0.2lr)
|
30 |
|
|
FOO_FUN (llf, long long _Fract, 0.2llr)
|
31 |
|
|
FOO_FUN (usf, unsigned short _Fract, 0.2uhr)
|
32 |
|
|
FOO_FUN (uf, unsigned _Fract, 0.2ur)
|
33 |
|
|
FOO_FUN (ulf, unsigned long _Fract, 0.2ulr)
|
34 |
|
|
FOO_FUN (ullf, unsigned long long _Fract, 0.2ullr)
|
35 |
|
|
FOO_FUN (Ssf, _Sat short _Fract, 0.2hr)
|
36 |
|
|
FOO_FUN (Sf, _Sat _Fract, 0.2r)
|
37 |
|
|
FOO_FUN (Slf, _Sat long _Fract, 0.2lr)
|
38 |
|
|
FOO_FUN (Sllf, _Sat long long _Fract, 0.2llr)
|
39 |
|
|
FOO_FUN (Susf, _Sat unsigned short _Fract, 0.2uhr)
|
40 |
|
|
FOO_FUN (Suf, _Sat unsigned _Fract, 0.2ur)
|
41 |
|
|
FOO_FUN (Sulf, _Sat unsigned long _Fract, 0.2ulr)
|
42 |
|
|
FOO_FUN (Sullf, _Sat unsigned long long _Fract, 0.2ullr)
|
43 |
|
|
FOO_FUN (sa, short _Accum, 0.2hk)
|
44 |
|
|
FOO_FUN (a, _Accum, 0.2k)
|
45 |
|
|
FOO_FUN (la, long _Accum, 0.2lk)
|
46 |
|
|
FOO_FUN (lla, long long _Accum, 0.2llk)
|
47 |
|
|
FOO_FUN (usa, unsigned short _Accum, 0.2uhk)
|
48 |
|
|
FOO_FUN (ua, unsigned _Accum, 0.2uk)
|
49 |
|
|
FOO_FUN (ula, unsigned long _Accum, 0.2ulk)
|
50 |
|
|
FOO_FUN (ulla, unsigned long long _Accum, 0.2ullk)
|
51 |
|
|
FOO_FUN (Ssa, _Sat short _Accum, 0.2hk)
|
52 |
|
|
FOO_FUN (Sa, _Sat _Accum, 0.2k)
|
53 |
|
|
FOO_FUN (Sla, _Sat long _Accum, 0.2lk)
|
54 |
|
|
FOO_FUN (Slla, _Sat long long _Accum, 0.2llk)
|
55 |
|
|
FOO_FUN (Susa, _Sat unsigned short _Accum, 0.2uhk)
|
56 |
|
|
FOO_FUN (Sua, _Sat unsigned _Accum, 0.2uk)
|
57 |
|
|
FOO_FUN (Sula, _Sat unsigned long _Accum, 0.2ulk)
|
58 |
|
|
FOO_FUN (Sulla, _Sat unsigned long long _Accum, 0.2ullk)
|
59 |
|
|
|
60 |
|
|
int
|
61 |
|
|
main ()
|
62 |
|
|
{
|
63 |
|
|
FOO_TEST (sf, short _Fract, 0.2hr)
|
64 |
|
|
FOO_TEST (f, _Fract, 0.2r)
|
65 |
|
|
FOO_TEST (lf, long _Fract, 0.2lr)
|
66 |
|
|
FOO_TEST (llf, long long _Fract, 0.2llr)
|
67 |
|
|
FOO_TEST (usf, unsigned short _Fract, 0.2uhr)
|
68 |
|
|
FOO_TEST (uf, unsigned _Fract, 0.2ur)
|
69 |
|
|
FOO_TEST (ulf, unsigned long _Fract, 0.2ulr)
|
70 |
|
|
FOO_TEST (ullf, unsigned long long _Fract, 0.2ullr)
|
71 |
|
|
FOO_TEST (Ssf, _Sat short _Fract, 0.2hr)
|
72 |
|
|
FOO_TEST (Sf, _Sat _Fract, 0.2r)
|
73 |
|
|
FOO_TEST (Slf, _Sat long _Fract, 0.2lr)
|
74 |
|
|
FOO_TEST (Sllf, _Sat long long _Fract, 0.2llr)
|
75 |
|
|
FOO_TEST (Susf, _Sat unsigned short _Fract, 0.2uhr)
|
76 |
|
|
FOO_TEST (Suf, _Sat unsigned _Fract, 0.2ur)
|
77 |
|
|
FOO_TEST (Sulf, _Sat unsigned long _Fract, 0.2ulr)
|
78 |
|
|
FOO_TEST (Sullf, _Sat unsigned long long _Fract, 0.2ullr)
|
79 |
|
|
FOO_TEST (sa, short _Accum, 0.2hk)
|
80 |
|
|
FOO_TEST (a, _Accum, 0.2k)
|
81 |
|
|
FOO_TEST (la, long _Accum, 0.2lk)
|
82 |
|
|
FOO_TEST (lla, long long _Accum, 0.2llk)
|
83 |
|
|
FOO_TEST (usa, unsigned short _Accum, 0.2uhk)
|
84 |
|
|
FOO_TEST (ua, unsigned _Accum, 0.2uk)
|
85 |
|
|
FOO_TEST (ula, unsigned long _Accum, 0.2ulk)
|
86 |
|
|
FOO_TEST (ulla, unsigned long long _Accum, 0.2ullk)
|
87 |
|
|
FOO_TEST (Ssa, _Sat short _Accum, 0.2hk)
|
88 |
|
|
FOO_TEST (Sa, _Sat _Accum, 0.2k)
|
89 |
|
|
FOO_TEST (Sla, _Sat long _Accum, 0.2lk)
|
90 |
|
|
FOO_TEST (Slla, _Sat long long _Accum, 0.2llk)
|
91 |
|
|
FOO_TEST (Susa, _Sat unsigned short _Accum, 0.2uhk)
|
92 |
|
|
FOO_TEST (Sua, _Sat unsigned _Accum, 0.2uk)
|
93 |
|
|
FOO_TEST (Sula, _Sat unsigned long _Accum, 0.2ulk)
|
94 |
|
|
FOO_TEST (Sulla, _Sat unsigned long long _Accum, 0.2ullk)
|
95 |
|
|
|
96 |
|
|
return 0;
|
97 |
|
|
}
|