public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/40334]  New: 4.5 regression: changed BACKSPACE behaviour at end of file.
@ 2009-06-04  0:29 bartoldeman at users dot sourceforge dot net
  2009-06-04  0:30 ` [Bug libfortran/40334] " bartoldeman at users dot sourceforge dot net
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bartoldeman at users dot sourceforge dot net @ 2009-06-04  0:29 UTC (permalink / raw)
  To: gcc-bugs

The following program (also attached) reads to eof, backspace, reads (eof
detected), backspace, and reads again. The last read gets the last line with
gfortran 4.5 (tested: r148116) but eof with gfortran <= 4.4, g95, g77 and Sun
f95.

>From reading comp.lang.fortran I know that EOF/BACKSPACE interaction can be
problematic but I'd still hope this would work to be consistent with the other
compilers.

      PROGRAM TEST
      IMPLICIT NONE
      CHARACTER(LEN=5) :: STR
      OPEN(2,FILE='fort.2',ACCESS='sequential')
      WRITE(2,'(A)')'HELLO'
      REWIND(2)

      DO
         READ(2,'(A)',END=1) STR
         PRINT *,STR
      ENDDO
 1    BACKSPACE 2
      !the file pointer is now at EOF

      READ(2,*,END=2) STR
      PRINT *,'error1: not at eof',str
      STOP
 2    BACKSPACE 2
      !the file pointer is now at EOF

      READ(2,'(A)',END=3) STR
      PRINT *,'error2: not at eof'
      STOP
 3    PRINT *,'correct'
      END


-- 
           Summary: 4.5 regression: changed BACKSPACE behaviour at end of
                    file.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bartoldeman at users dot sourceforge dot net
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug libfortran/40334] 4.5 regression: changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
@ 2009-06-04  0:30 ` bartoldeman at users dot sourceforge dot net
  2009-06-04  1:13 ` jvdelisle at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bartoldeman at users dot sourceforge dot net @ 2009-06-04  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bartoldeman at users dot sourceforge dot net  2009-06-04 00:30 -------
Created an attachment (id=17950)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17950&action=view)
Test case


-- 


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


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

* [Bug libfortran/40334] 4.5 regression: changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
  2009-06-04  0:30 ` [Bug libfortran/40334] " bartoldeman at users dot sourceforge dot net
@ 2009-06-04  1:13 ` jvdelisle at gcc dot gnu dot org
  2009-06-04  1:15 ` [Bug libfortran/40334] 4.4,4.5 " jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-04  1:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2009-06-04 01:13 -------
Confirmed on 4.4 and 4.5. I checked with 4.3, ifort, open64, and Sun


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.4.1 4.5.0
      Known to work|                            |4.3.4
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-04 01:13:44
               date|                            |


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


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

* [Bug libfortran/40334] 4.4,4.5 regression: changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
  2009-06-04  0:30 ` [Bug libfortran/40334] " bartoldeman at users dot sourceforge dot net
  2009-06-04  1:13 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-04  1:15 ` jvdelisle at gcc dot gnu dot org
  2009-06-04  6:41 ` [Bug libfortran/40334] [4.4, 4.5 Regression] " burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-04  1:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|4.5 regression: changed     |4.4,4.5 regression: changed
                   |BACKSPACE behaviour at end  |BACKSPACE behaviour at end
                   |of file.                    |of file.
   Target Milestone|---                         |4.4.1


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


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

* [Bug libfortran/40334] [4.4, 4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2009-06-04  1:15 ` [Bug libfortran/40334] 4.4,4.5 " jvdelisle at gcc dot gnu dot org
@ 2009-06-04  6:41 ` burnus at gcc dot gnu dot org
  2009-06-04 11:39 ` [Bug libfortran/40334] [4.4/4.5 " rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-06-04  6:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2009-06-04 06:41 -------
With trunk 2009-04-05-r145558 I get
 HELLO
 correct
while with trunk 2009-04-06-r145580 the result is
 HELLO
 error2: not at eof

It is not surprising that the following patch was checked in between those
revisions:

 jvdelisle | 2009-04-05 22:13:56 +0200 (Sun, 05 Apr 2009) | 201 lines
http://gcc.gnu.org/viewcvs?view=rev&revision=145571

2009-04-05  Daniel Kraft  <d@domob.eu>
        PR fortran/38654
2009-04-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
        PR libfortran/37754
2009-04-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
        PR libfortran/37754
2009-04-05  Janne Blomqvist  <jb@gcc.gnu.org>
        PR libfortran/25561 libfortran/37754

Note: The 4.4.1 release is planned for June 21.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu dot org,
                   |                            |jvdelisle at gcc dot gnu dot
                   |                            |org
  GCC build triplet|x86_64-unknown-linux-gnu    |
 GCC target triplet|x86_64-unknown-linux-gnu    |
           Keywords|                            |wrong-code
            Summary|4.4,4.5 regression: changed |[4.4, 4.5 Regression]
                   |BACKSPACE behaviour at end  |changed BACKSPACE behaviour
                   |of file.                    |at end of file.


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2009-06-04  6:41 ` [Bug libfortran/40334] [4.4, 4.5 Regression] " burnus at gcc dot gnu dot org
@ 2009-06-04 11:39 ` rguenth at gcc dot gnu dot org
  2009-06-06 16:08 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-04 11:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
            Summary|[4.4, 4.5 Regression]       |[4.4/4.5 Regression] changed
                   |changed BACKSPACE behaviour |BACKSPACE behaviour at end
                   |at end of file.             |of file.


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2009-06-04 11:39 ` [Bug libfortran/40334] [4.4/4.5 " rguenth at gcc dot gnu dot org
@ 2009-06-06 16:08 ` jvdelisle at gcc dot gnu dot org
  2009-06-06 16:09 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-06 16:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2009-06-06 16:08 -------
In the test case, the the first EOF is generated in transfer.c (hit_eof) which
sets the end file conditions.  The second EOF is generated in list_read.c:1689.
When returning from he error condition, the end file conditions are not set.

I have regtested this rough patch.

Index: list_read.c
===================================================================
--- list_read.c (revision 147996)
+++ list_read.c (working copy)
@@ -1687,6 +1687,11 @@ list_formatted_read_scalar (st_parameter
   if (setjmp (eof_jump))
     {
       generate_error (&dtp->common, LIBERROR_END, NULL);
+       if (!is_internal_unit (dtp))
+         {
+           dtp->u.p.current_unit->endfile = AFTER_ENDFILE;
+           dtp->u.p.current_unit->current_record = 0;
+         }
       goto cleanup;
     }


-- 


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (5 preceding siblings ...)
  2009-06-06 16:08 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-06 16:09 ` jvdelisle at gcc dot gnu dot org
  2009-06-07 17:40 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-06 16:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2009-06-06 16:09 -------
Correction "have not" regtested the patch above.


-- 


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (6 preceding siblings ...)
  2009-06-06 16:09 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-07 17:40 ` jvdelisle at gcc dot gnu dot org
  2009-06-09  3:15 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-07 17:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2009-06-07 17:40 -------
Subject: Bug 40334

Author: jvdelisle
Date: Sun Jun  7 17:40:24 2009
New Revision: 148251

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

        PR libfortran/40334
        * io/list_read.c (list_formatted_read_scalar): Set the end file
        conditions after a return from EOF error.

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


-- 


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (7 preceding siblings ...)
  2009-06-07 17:40 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-09  3:15 ` jvdelisle at gcc dot gnu dot org
  2009-06-09  3:18 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-09  3:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2009-06-09 03:15 -------
Subject: Bug 40334

Author: jvdelisle
Date: Tue Jun  9 03:15:04 2009
New Revision: 148303

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

        PR libfortran/40334
        * io/list_read.c (list_formatted_read_scalar): Set the end file
        conditions after a return from EOF error.

Modified:
    branches/gcc-4_4-branch/libgfortran/ChangeLog
    branches/gcc-4_4-branch/libgfortran/io/list_read.c


-- 


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (8 preceding siblings ...)
  2009-06-09  3:15 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-09  3:18 ` jvdelisle at gcc dot gnu dot org
  2009-06-09  3:19 ` jvdelisle at gcc dot gnu dot org
  2009-06-09 20:30 ` jb at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-09  3:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2009-06-09 03:18 -------
Subject: Bug 40334

Author: jvdelisle
Date: Tue Jun  9 03:18:30 2009
New Revision: 148304

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

        PR libfortran/40334
        * gfortran.dg/backspace_11.f90: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/backspace_11.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (9 preceding siblings ...)
  2009-06-09  3:18 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-09  3:19 ` jvdelisle at gcc dot gnu dot org
  2009-06-09 20:30 ` jb at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-09  3:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2009-06-09 03:19 -------
Fixed on 4.4 and 4.5


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug libfortran/40334] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
  2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
                   ` (10 preceding siblings ...)
  2009-06-09  3:19 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-09 20:30 ` jb at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-06-09 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jb at gcc dot gnu dot org  2009-06-09 20:29 -------
Subject: Bug 40334

Author: jb
Date: Tue Jun  9 20:29:33 2009
New Revision: 148324

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148324
Log:
PR libfortran/40334 backspace regression

Added:
    trunk/gcc/testsuite/gfortran.dg/backspace_11.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2009-06-09 20:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-04  0:29 [Bug libfortran/40334] New: 4.5 regression: changed BACKSPACE behaviour at end of file bartoldeman at users dot sourceforge dot net
2009-06-04  0:30 ` [Bug libfortran/40334] " bartoldeman at users dot sourceforge dot net
2009-06-04  1:13 ` jvdelisle at gcc dot gnu dot org
2009-06-04  1:15 ` [Bug libfortran/40334] 4.4,4.5 " jvdelisle at gcc dot gnu dot org
2009-06-04  6:41 ` [Bug libfortran/40334] [4.4, 4.5 Regression] " burnus at gcc dot gnu dot org
2009-06-04 11:39 ` [Bug libfortran/40334] [4.4/4.5 " rguenth at gcc dot gnu dot org
2009-06-06 16:08 ` jvdelisle at gcc dot gnu dot org
2009-06-06 16:09 ` jvdelisle at gcc dot gnu dot org
2009-06-07 17:40 ` jvdelisle at gcc dot gnu dot org
2009-06-09  3:15 ` jvdelisle at gcc dot gnu dot org
2009-06-09  3:18 ` jvdelisle at gcc dot gnu dot org
2009-06-09  3:19 ` jvdelisle at gcc dot gnu dot org
2009-06-09 20:30 ` jb 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).