This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/20179] cannot mix C and Fortran I/O
- From: "stevenj at alum dot mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 May 2005 23:51:20 -0000
- Subject: [Bug libfortran/20179] cannot mix C and Fortran I/O
- References: <20050223193435.20179.stevenj@fftw.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From stevenj at alum dot mit dot edu 2005-05-24 23:51 -------
I doubt that merely omitting close() from the end of the library will entirely
fix the problem. You really need to add an fflush before every output to stdio.
For example, modify ciotst.f to:
program ciotst
call cio
write(*,*) 'Hello world.'
call cio
end
The g77 output is:
foo
bar
baz Hello world.
foo
bar
baz
as you would expect, but the gfortran output is in the wrong order (as well as
missing the final "baz" in my unpatched gfortran) because of missing flushes:
foo
bar
Hello world.
bazfoo
bar
(If you look in libf2c you'll see that it uses fflush in a number of places.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20179