This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
bug? runtime error passing POD
- From: Daniel Franke <daniel dot franke at imbs dot uni-luebeck dot de>
- To: fortran at gcc dot gnu dot org
- Date: Mon, 4 Jul 2005 20:08:22 +0200
- Subject: bug? runtime error passing POD
- Organization: Institute of Medical Biometry and Statistics
Hi all,
before filing a bug report I'd like to double check whether this is a bug or
not (I don't know anything about fortran, I just have to use it).
Synopsis: Pass a single value from C to F90.
The code snipplet below compiles using g77-3.3 as well as using
gfortran-4.0.1-20050616:
-- f.f --
1 SUBROUTINE f( n )
2 integer :: n
3 print *, "n = ", n
4 END SUBROUTINE f--
--
To pass a value to fortran-77, one has to provide the address. Assumption:
plain old data types are handled likewise in fortran-90/gfortran (I know that
there are array types that aren't).
-- test.c --
1 void f_(int *);
2 int main() {
3 int n = 42;
4 f_(&n);
5 return 0;
6 }
--
Compiling and linking results in:
$>./test.g77
n = 42
$> ./test.gfortran
Fortran runtime error: End of record
Compiling the same code using SUN's f77/f90 compilers results in:
$>./test.f77
n = 42
$>./test.f90
n = 42
Question: Bug in gfortran or misunderstanding on my side?
Thanks
Daniel