2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_by_val_1.f
blob3c5c3d7def7b6c8bf41fee3e92e6367e88911540
1 C { dg-do run }
2 C { dg-additional-sources c_by_val.c }
3 C { dg-options "-ff2c -w -O0" }
5 program c_by_val_1
6 external f_to_f, i_to_i, c_to_c
7 external f_to_f8, i_to_i8, c_to_c8
8 real a, b, c
9 real(8) a8, b8, c8
10 integer(4) i, j, k
11 integer(8) i8, j8, k8
12 complex u, v, w
13 complex(8) u8, v8, w8
15 a = 42.0
16 b = 0.0
17 c = a
18 call f_to_f (b, %VAL (a), %REF (c), %LOC (c))
19 if ((2.0 * a).ne.b) call abort ()
21 a8 = 43.0
22 b8 = 1.0
23 c8 = a8
24 call f_to_f8 (b8, %VAL (a8), %REF (c8), %LOC (c8))
25 if ((2.0 * a8).ne.b8) call abort ()
27 i = 99
28 j = 0
29 k = i
30 call i_to_i (j, %VAL (i), %REF (k), %LOC (k))
31 if ((3 * i).ne.j) call abort ()
33 i8 = 199
34 j8 = 10
35 k8 = i8
36 call i_to_i8 (j8, %VAL (i8), %REF (k8), %LOC (k8))
37 if ((3 * i8).ne.j8) call abort ()
39 u = (-1.0, 2.0)
40 v = (1.0, -2.0)
41 w = u
42 call c_to_c (v, %VAL (u), %REF (w), %LOC (w))
43 if ((4.0 * u).ne.v) call abort ()
45 u8 = (-1.0, 2.0)
46 v8 = (1.0, -2.0)
47 w8 = u8
48 call c_to_c8 (v8, %VAL (u8), %REF (w8), %LOC (w8))
49 if ((4.0 * u8).ne.v8) call abort ()
51 stop
52 end