Debian Codegraph @

gcc/testsuite/c-c++-common/dfp/call-by-value.c

raw
1 /* C99 6.9.1(9) Function definitions; parameter has automatic storage.
2
3 Test that actual parameters are passed by value and that modifications
4 made within functions are lost on function return. */
5
6 #include "dfp-dbg.h"
7
8 void foo32 (_Decimal32 z)
9 {
10 z = z + 1.0df;
11 }
12
13 void foo64 (_Decimal64 z)
14 {
15 z = z + 1.0dd;
16 }
17
18 void foo128 (_Decimal128 z)
19 {
20 z = z + 1.0dl;
21 }
22
23 int
24 main ()
25 {
26 _Decimal32 d32 = 1.1df;
27 _Decimal64 d64 = 1.2dd;
28 _Decimal128 d128 = 1.3dl;
29
30 foo32 (d32);
31 if (d32 != 1.1df)
32 FAILURE
33
34 foo64 (d64);
35 if (d64 != 1.2dd)
36 FAILURE
37
38 foo128 (d128);
39 if (d128 != 1.3dl)
40 FAILURE
41
42 FINISH
43 }