public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "manfred99 at gmx dot ch" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/59513] [4.8/4.9/4.10 Regression] Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE Date: Wed, 16 Jul 2014 10:37:00 -0000 [thread overview] Message-ID: <bug-59513-4-kqNXCVhkGq@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-59513-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59513 --- Comment #25 from Manfred Schwarb <manfred99 at gmx dot ch> --- OK, thanks Jerry and Dominique for the explanations. It seems the correct syntax then is: READ(lun,END=100) buffer GOTO 101 100 BACKSPACE(lun) 101 WRITE(lun,*) "whatever" Not that the above code would make sense to me as a mere user, but it works both with gfortran 4.5 and 4.6 upwards. I just wrote a small test program, the output is identical for gfortran 4.5 and 4.6+: CHARACTER*20 buffer,buffer2 INTEGER i buffer="" buffer2="" OPEN(10,FILE="test.txt") WRITE(10,'(a)') "0123456789" CLOSE(10) OPEN(10,FILE="test.txt",POSITION="APPEND") CALL ftell(10,i) print*,"file position in append mode:",i CLOSE(10) OPEN(10,FILE="test.txt") READ(10,'(a20)') buffer print*,"X",buffer,"X" CALL ftell(10,i) print*,"file position after reading buffer:",i CC BACKSPACE(10) ! then below write will overwrite first line WRITE(10,'(a)') "ABC" CLOSE(10) CALL system("cat test.txt") OPEN(10,FILE="test.txt") WRITE(10,'(a)') "0123456789" CLOSE(10) OPEN(10,FILE="test.txt") READ(10,'(a20)',END=100) buffer,buffer2 GOTO 101 100 CALL ftell(10,i) print*,"END clause encountered: file position:",i BACKSPACE(10) 101 CALL ftell(10,i) print*,"file position:",i print*,"X",buffer,"X",buffer2,"X" WRITE(10,'(a)') "ABC" CLOSE(10) CALL system("cat test.txt") END
next prev parent reply other threads:[~2014-07-16 10:37 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-59513-4@http.gcc.gnu.org/bugzilla/> 2013-12-15 22:19 ` [Bug libfortran/59513] " jvdelisle at gcc dot gnu.org 2013-12-15 22:33 ` aruopp at gmx dot de 2013-12-16 0:02 ` aruopp at gmx dot de 2013-12-18 14:53 ` aruopp at gmx dot de 2013-12-18 14:56 ` aruopp at gmx dot de 2013-12-18 14:57 ` aruopp at gmx dot de 2013-12-18 15:04 ` dominiq at lps dot ens.fr 2013-12-18 15:19 ` aruopp at gmx dot de 2013-12-18 16:23 ` dominiq at lps dot ens.fr 2013-12-18 16:35 ` [Bug libfortran/59513] [4.7/4.8/4.9] " dominiq at lps dot ens.fr 2013-12-19 15:21 ` rguenth at gcc dot gnu.org 2013-12-19 15:43 ` rguenth at gcc dot gnu.org 2014-05-27 13:01 ` giorgio.signorini at unifi dot it 2014-06-12 13:52 ` [Bug libfortran/59513] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org 2014-07-11 17:33 ` [Bug libfortran/59513] [4.8/4.9/4.10 " dominiq at lps dot ens.fr 2014-07-12 11:39 ` dominiq at lps dot ens.fr 2014-07-12 13:11 ` dominiq at lps dot ens.fr 2014-07-12 13:24 ` dominiq at lps dot ens.fr 2014-07-12 18:02 ` dominiq at lps dot ens.fr 2014-07-12 19:43 ` jvdelisle at gcc dot gnu.org 2014-07-15 16:39 ` dominiq at lps dot ens.fr 2014-07-15 21:44 ` manfred99 at gmx dot ch 2014-07-15 22:07 ` dominiq at lps dot ens.fr 2014-07-16 1:45 ` jvdelisle at gcc dot gnu.org 2014-07-16 10:37 ` manfred99 at gmx dot ch [this message] 2014-07-16 10:49 ` manfred99 at gmx dot ch 2014-12-19 13:34 ` [Bug libfortran/59513] [4.8/4.9/5 " jakub at gcc dot gnu.org 2015-03-22 22:59 ` jvdelisle at gcc dot gnu.org 2015-03-22 23:56 ` jvdelisle at gcc dot gnu.org 2015-03-25 18:46 ` dominiq at lps dot ens.fr 2015-03-30 17:45 ` jvdelisle at gcc dot gnu.org 2015-03-30 21:59 ` jvdelisle at gcc dot gnu.org 2015-03-30 22:35 ` jvdelisle at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-59513-4-kqNXCVhkGq@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).