FreeBSD Fortran Failure

Mark Mitchell mark@codesourcery.com
Sun May 13 15:25:00 GMT 2001


>>>>> "Joseph" == Joseph S Myers <jsm28@cam.ac.uk> writes:

    Joseph> http://www.opengroup.org/onlinepubs/7908799/xsh/stdio.html

Thanks.  It would have been more helpful to post that originally,
since you knew where it was.

The bottom line is that I think the libf2c plays within the rules.  We
have:

	fflush(b->ufd);
	rc = ftruncate(fileno(b->ufd),loc);

The fflush makes it legal to switch from the currently actively handle
(the stream) to the new one (the file descriptor).

Then, we shouldn't need an fseek to switch back to the stream because
you only need that if the previously actively handle changed the file
offset, and `ftruncate' is specifically documented not to change the
file offset.

However, that web page also says:

  "It is implementation-dependent whether, and under what conditions,
   all input is seen exactly once."

I don't know exactly what that means.

Anyhow, immediately upon return to our caller (f_rew), we call
`rewind', which is supposed to be exactly equivalent to an appropriate
`fseek'.

It is possible that this a bug in OpenBSD.  

In which case, we need to do the freopen thing anyhow.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com



More information about the Gcc-bugs mailing list