Gnu C/Fortran bug?
Tim Prince
tprince@computer.org
Fri Apr 12 13:28:00 GMT 2002
On Friday 12 April 2002 12:23, Toon Moene wrote:
> Mehry Yazdanian wrote:
> > I have a simple program which works fine under Solaris/unix but does not
> > work correctly under Linux.
> >
> > I have a fortran 3 line program which calls a C routine which reads from
> > stdin using fgets and then echoes back what is typed, using fputs. That
> > works ok but when it returns from the c call in fortran, it should type
> > on the screen "Returned From Subroutine". But instead it types "Returned
> > from Subroutine", when it is waiting for the user to type the line.
>
> Note that the way to combine Fortran and C code in one executable is
> compiler-dependent and should be documented in the compiler manual.
>
> Apparently, this works differently for g77 and gcc than for the Solaris
> compilers.
>
> For g77/gcc, see the Fortran manual, chapter 12:
>
> http://gcc.gnu.org/onlinedocs/gcc-3.0.4/g77_16.html#SEC551
Apparently, what is being done here is more than compiler-dependent, it is
library-dependent. It is always risky to have both Fortran and C dealing
with the same I/O unit (stdin, stdout).
--
Tim Prince
More information about the Gcc-bugs
mailing list