OSDN Git Service

* lib/target-supports.exp (check_effective_target_dfp_nocache,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dfp / call-by-value.c
1 /* { dg-options "-std=gnu99" } */
2
3 /* C99 6.9.1(9) Function definitions; parameter has automatic storage.
4
5    Test that actual parameters are passed by value and that modifications
6    made within functions are lost on function return.  */
7
8 extern void abort (void);
9
10 int foo32 (_Decimal32 z)
11 {
12   z = z + 1.0df;
13 }
14
15 int foo64 (_Decimal64 z)
16 {
17   z = z + 1.0dd;
18 }
19
20 int foo128 (_Decimal128 z)
21 {
22   z = z + 1.0dl;
23 }
24
25 int
26 main ()
27 {
28   _Decimal32 d32 = 1.1df;
29   _Decimal64 d64 = 1.2dd;
30   _Decimal128 d128 = 1.3dl;
31
32   foo32 (d32);
33   if (d32 != 1.1df)
34     abort ();
35
36   foo64 (d64);
37   if (d64 != 1.2dd)
38     abort ();
39
40   foo128 (d128);
41   if (d128 != 1.3dl)
42     abort ();
43
44   return 0;
45 }