diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/f2c_4.f90 | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/f2c_4.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2c_4.f90 | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/f2c_4.f90 b/gcc/testsuite/gfortran.dg/f2c_4.f90 new file mode 100644 index 000000000..a0d1909bf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2c_4.f90 @@ -0,0 +1,58 @@ +! { dg-do run } +! { dg-additional-sources f2c_4.c } +! { dg-options "-ff2c -w" } + +! Check -ff2c calling conventions +! Return value of REAL function is promoted to C type double +! Return value of COMPLEX function is via an extra argument in the +! calling sequence that points to where to store the return value +! Addional underscore appended to function name +program f2c_4 + complex c, f2c_4k, f2c_4l + double complex z, f2c_4m, f2c_4n + integer i + + ! Promotion of REAL function + call f2c_4a() + + ! Return COMPLEX arg - call Fortran routines from C + call f2c_4c() + call f2c_4e() + call f2c_4g() + call f2c_4i() + + ! Return COMPLEX arg - call C routines from Fortran + c = cmplx(1234.0,5678.0) + z = dcmplx(1234.0d0,5678.0d0) + if ( c .ne. f2c_4k(c) ) call abort + if ( c .ne. f2c_4l(i,c) ) call abort + if ( z .ne. f2c_4m(z) ) call abort + if ( z .ne. f2c_4n(i,z) ) call abort + +end + +real function f2c_4b(x) + double precision x + f2c_4b = x +end + +complex function f2c_4d(x) + complex x + f2c_4d = x +end + +complex function f2c_4f(i,x) + complex x + integer i + f2c_4f = x +end + +double complex function f2c_4h(x) + double complex x + f2c_4h = x +end + +double complex function f2c_4j(i,x) + double complex x + f2c_4j = x +end |