public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32235]  New: gfortran - incorrectly position text file after backspace
@ 2007-06-06 16:16 dir at lanl dot gov
  2007-06-06 20:31 ` [Bug fortran/32235] " burnus at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dir at lanl dot gov @ 2007-06-06 16:16 UTC (permalink / raw)
  To: gcc-bugs

g77, g95, Absoft 9.2, etc.. position the text file correctly, but gfortran is
off by one line -

[dranta:~/tests/gfortran-D] dir% gfortran -fno-automatic -std=legacy -o aRead01
aRead01.f
[dranta:~/tests/gfortran-D] dir% aRead01 < aRead01.in
                      1        one                                              
                      2        Two                                              
                      3        Three                                            
read =Two       
[dranta:~/tests/gfortran-D] dir% g77 -o aRead01 aRead01.f
[dranta:~/tests/gfortran-D] dir% aRead01 < aRead01.in
                      1        one                                              
                      2        Two                                              
                      3        Three                                            
read =Three     
[dranta:~/tests/gfortran-D] dir% cat aRead01.f
      program main
      character*10 a
      ncards=2
      read(5,1000)a
      read(5,1000)a
      call inlist(ncards)
      read(5,1000)a
      write(6,2000)a
      stop
 1000 format(a10)
 2000 format('read =',a10)
      end
      subroutine inlist(ncards)
      character*4 data(20)
      input=5
c
      if (ncards.eq.0) go to 20
      do 15 i=1,ncards
      backspace input
   15 continue
c
   20 continue
      kard  = 0
   30 read(5,1000,end=60)   data
   40 kard=kard + 1
   50 write (6,2020) kard,data
      go to 30
   60 continue
      kard=kard - ncards + 1
      do 70   i=1,kard
      backspace input
   70 continue
c
      return
c
 1000 format (20a4)
 2020 format (8x,i15,8x,20a4)
c
      end
[dranta:~/tests/gfortran-D] dir% cat aRead01.in
one                   
Two                   
Three                 
[dranta:~/tests/gfortran-D] dir% gfortran --v
Using built-in specs.
Target: powerpc-apple-darwin8.9.0
Configured with: ../gcc/configure --enable-checking --disable-multilib
--prefix=/usr/local/gfortran --enable-languages=c,fortran
Thread model: posix
gcc version 4.3.0 20070604 (experimental)


-- 
           Summary: gfortran - incorrectly position text file after
                    backspace
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dir at lanl dot gov
  GCC host triplet: powerpc-apple-darwin8.9.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] gfortran - incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
@ 2007-06-06 20:31 ` burnus at gcc dot gnu dot org
  2007-06-07  0:14 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-06 20:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-06-06 20:31 -------
I may do something wrong, but I get with this example always:
  read =Three
I tried gfortran, g95, NAG f95, g77 and ifort with the same result.
Additionally, I is a bit unclear how using backspace on standard in (stdin,
unit=5) is supposed to work.


However, I'm able to reporduce the difference with using:
       open(5,file='aRead01.in')
In this case gfortran shows "read =Two" whereas with the other compilers
"read =Three" is shown.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] gfortran - incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
  2007-06-06 20:31 ` [Bug fortran/32235] " burnus at gcc dot gnu dot org
@ 2007-06-07  0:14 ` jvdelisle at gcc dot gnu dot org
  2007-06-07 13:14 ` dir at lanl dot gov
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-07  0:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-06-07 00:14 -------
Investigating


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-07 00:14:42
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] gfortran - incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
  2007-06-06 20:31 ` [Bug fortran/32235] " burnus at gcc dot gnu dot org
  2007-06-07  0:14 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-07 13:14 ` dir at lanl dot gov
  2007-06-09 19:28 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dir at lanl dot gov @ 2007-06-07 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dir at lanl dot gov  2007-06-07 13:13 -------
Most compilers assume that you need to backspace back over the End-Of-File.
This goes back to the good old days, when the EOF was actually a tape mark.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] gfortran - incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (2 preceding siblings ...)
  2007-06-07 13:14 ` dir at lanl dot gov
@ 2007-06-09 19:28 ` jvdelisle at gcc dot gnu dot org
  2007-06-09 19:37 ` [Bug fortran/32235] [4.3 Regression] " jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-09 19:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2007-06-09 19:27 -------
There are a couple of issues going on here.  First, if the input file is a
regular file which is seekable, gfortran is indeed giving the wrong result. 
This is because the endfile condition was not being set after an EOF error
condition which is trapped in "subroutine inlist".  This is easily fixed. (I
have the patch tested)

The second issue is that when using redirection with standard input, the file
is not seekable and the results may depend on the underlying OS and buffering.
I suspect that if you back spaced enough under the right conditions you would
exhaust the buffer as you go back and will eventually fail.   I will be giving
this second issue some more thought. Especially since it works on g77 for at
least the simple caee of a few backspaces.  


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] [4.3 Regression] incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (3 preceding siblings ...)
  2007-06-09 19:28 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-09 19:37 ` jvdelisle at gcc dot gnu dot org
  2007-06-09 20:53 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-09 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-06-09 19:37 -------
I have confirmed that this is a regression against g77, 4.2 and 4.1 in all
cases, so the hunt is on.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gfortran - incorrectly      |[4.3 Regression] incorrectly
                   |position text file after    |position text file after
                   |backspace                   |backspace


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] [4.3 Regression] incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (4 preceding siblings ...)
  2007-06-09 19:37 ` [Bug fortran/32235] [4.3 Regression] " jvdelisle at gcc dot gnu dot org
@ 2007-06-09 20:53 ` jvdelisle at gcc dot gnu dot org
  2007-06-10  2:20 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-09 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-06-09 20:52 -------
The patch that broke this is r123403 which is my patch for 31052.  Not
surprising.  We need to be real careful here because this patch fixes a
regression we had on SPEC.  I will need someone with SPEC access to test the
fix for this as soon as I get it done. :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] [4.3 Regression] incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (5 preceding siblings ...)
  2007-06-09 20:53 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-10  2:20 ` patchapp at dberlin dot org
  2007-06-10 22:51 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-06-10  2:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2007-06-10 02:20 -------
Subject: Bug number PR32235

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg00596.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] [4.3 Regression] incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (6 preceding siblings ...)
  2007-06-10  2:20 ` patchapp at dberlin dot org
@ 2007-06-10 22:51 ` jvdelisle at gcc dot gnu dot org
  2007-06-11  3:06 ` jvdelisle at gcc dot gnu dot org
  2007-06-11 17:52 ` jvdelisle at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-10 22:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2007-06-10 22:50 -------
Subject: Bug 32235

Author: jvdelisle
Date: Sun Jun 10 22:50:47 2007
New Revision: 125606

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125606
Log:
2007-06-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/32235
        * io/transfer.c (st_read): Remove test for end of file condition.
        (next_record_r): Add test for end of file condition.


Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/transfer.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] [4.3 Regression] incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (7 preceding siblings ...)
  2007-06-10 22:51 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-11  3:06 ` jvdelisle at gcc dot gnu dot org
  2007-06-11 17:52 ` jvdelisle at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-11  3:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2007-06-11 03:06 -------
Subject: Bug 32235

Author: jvdelisle
Date: Mon Jun 11 03:06:01 2007
New Revision: 125611

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125611
Log:
2007-06-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/32235
        * gfortran.dg/backspace_9.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/backspace_9.f
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32235] [4.3 Regression] incorrectly position text file after backspace
  2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
                   ` (8 preceding siblings ...)
  2007-06-11  3:06 ` jvdelisle at gcc dot gnu dot org
@ 2007-06-11 17:52 ` jvdelisle at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-06-11 17:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2007-06-11 17:51 -------
Fixed on trunk.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32235


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-06-11 17:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-06 16:16 [Bug fortran/32235] New: gfortran - incorrectly position text file after backspace dir at lanl dot gov
2007-06-06 20:31 ` [Bug fortran/32235] " burnus at gcc dot gnu dot org
2007-06-07  0:14 ` jvdelisle at gcc dot gnu dot org
2007-06-07 13:14 ` dir at lanl dot gov
2007-06-09 19:28 ` jvdelisle at gcc dot gnu dot org
2007-06-09 19:37 ` [Bug fortran/32235] [4.3 Regression] " jvdelisle at gcc dot gnu dot org
2007-06-09 20:53 ` jvdelisle at gcc dot gnu dot org
2007-06-10  2:20 ` patchapp at dberlin dot org
2007-06-10 22:51 ` jvdelisle at gcc dot gnu dot org
2007-06-11  3:06 ` jvdelisle at gcc dot gnu dot org
2007-06-11 17:52 ` jvdelisle at gcc dot gnu dot org

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