------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-10 16:06 ------- Looking at that again, it is clear that there is a bug in the way libgfortran handles pre-connected units. In short, the fd-based I/O library behaves like it is the first program to access the file; this is not right for pre-connected units. First example:
$ cat b.c extern void foo_(void); int main () { write (1, "Hello world\n", 13); foo_ (); return 0; } $ cat b.f subroutine foo write (*,"(A)") "Ciao world!" end $ ./b.out Hello world Fortran runtime error: End of record $ cat a.sh #!/bin/sh ${*} a.f echo Before ./a.out echo After $ cat a.f print *, "foo" end $ ./a.sh ./debug/irun/bin/gfortran -static > foo && cat foo foo After $ ./a.sh ./debug/irun/bin/gfortran -static Before foo After >From the strace, the problem is quite clear: fd_truncate is called on the fd #1 (stdout), when the unit is opened. -- What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20179