This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/20179] cannot mix C and Fortran I/O


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]