bug? runtime error passing POD
Daniel Franke
daniel.franke@imbs.uni-luebeck.de
Mon Jul 4 18:08:00 GMT 2005
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
More information about the Fortran
mailing list