OSDN Git Service

* gcc.dg/nodfp-1.c: New test.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dfp / call-by-value.c
1 /* { 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 extern void abort (void);
10
11 int foo32 (_Decimal32 z)
12 {
13   z = z + 1.0df;
14 }
15
16 int foo64 (_Decimal64 z)
17 {
18   z = z + 1.0dd;
19 }
20
21 int foo128 (_Decimal128 z)
22 {
23   z = z + 1.0dl;
24 }
25
26 int
27 main ()
28 {
29   _Decimal32 d32 = 1.1df;
30   _Decimal64 d64 = 1.2dd;
31   _Decimal128 d128 = 1.3dl;
32
33   foo32 (d32);
34   if (d32 != 1.1df)
35     abort ();
36
37   foo64 (d64);
38   if (d64 != 1.2dd)
39     abort ();
40
41   foo128 (d128);
42   if (d128 != 1.3dl)
43     abort ();
44
45   return 0;
46 }