backspace/endfile combination bug
Toon Moene
toon@moene.indiv.nluug.nl
Sun Nov 7 05:41:00 GMT 1999
[ CC'd to David M. Gay, author of f2c and the f2c run time library,
which is used by g77 ]
grhoden wrote:
> It appears that the file positioning gets screwed up when initiating a
> backspace command followed by an endfile command. This is for
> gcc-2.95.1 running on Mandrake linux 6.0. Attached is a bit of code
> that recreates the problem.
>
> This code when compiled with g77 -o testit test.f gives the following
> errors to xterm:
>
> fmt: end of file
> apparent state: unit 9 named ./test.txt
> last format: (A80)
> lately reading sequential formatted external IO
> Aborted (core dumped)
[ Program source: ]
> program test
> character chk2*80
> open(9,file='./test.txt')
> write(9,*) 'This is a test of the scratch file'
> write(9,*) 'Writing a second record'
> backspace (9)
> endfile (9)
> print *,'executed endfile command'
> rewind (9)
> print *,'executed rewind command'
> read(9,'(A80)') chk2
> c read(9,'(A80)') chk2
> c read(9,'(A80)') chk2
> print *,'executed read command'
> print *, chk2
> close (9)
> stop
> end
I could reproduce this behaviour with both g77/gcc-2.95.2 and the latest
f2c (downloaded today) on Red Hat Linux 5.2.
According to my reading of the Standard, this sequence of file
operations is allowed.
Unfortunately, I didn't succeed in tracking down the error.
--
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://gcc.gnu.org/onlinedocs/g77_news.html
More information about the Gcc-bugs
mailing list