2 ! { dg-additional-sources f2c_4.c }
3 ! { dg-options "-ff2c -w" }
5 ! Check -ff2c calling conventions
6 ! Return value of REAL function is promoted to C type double
7 ! Return value of COMPLEX function is via an extra argument in the
8 ! calling sequence that points to where to store the return value
9 ! Addional underscore appended to function name
11 complex c
, f2c_4k
, f2c_4l
12 double complex z
, f2c_4m
, f2c_4n
15 ! Promotion of REAL function
18 ! Return COMPLEX arg - call Fortran routines from C
24 ! Return COMPLEX arg - call C routines from Fortran
25 c
= cmplx(1234.0,5678.0)
26 z
= dcmplx(1234.0d0,5678.0d0)
27 if ( c
.ne
. f2c_4k(c
) ) STOP 1
28 if ( c
.ne
. f2c_4l(i
,c
) ) STOP 2
29 if ( z
.ne
. f2c_4m(z
) ) STOP 3
30 if ( z
.ne
. f2c_4n(i
,z
) ) STOP 4
34 real function f2c_4b(x
)
39 complex function f2c_4d(x
)
44 complex function f2c_4f(i
,x
)
50 double complex function f2c_4h(x
)
55 double complex function f2c_4j(i
,x
)