public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file
@ 2013-09-05 11:57 larix at libero dot it
  2013-09-06 21:24 ` [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker burnus at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: larix at libero dot it @ 2013-09-05 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58324
           Summary: Incorrect iostat while reading SEQUENTIAL file
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: larix at libero dot it

Created attachment 30750
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30750&action=edit
source code

reading a formatted sequential file, if last record is not teminated by
LineFeed character, 

read(unit=111,fmt=*, iostat=j) i
produces j= -1

while 
read(111,'(I1)', iostat=j) i
produces j= 0


see attached source reproducing the bug


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
@ 2013-09-06 21:24 ` burnus at gcc dot gnu.org
  2014-01-16 21:15 ` dominiq at lps dot ens.fr
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-09-06 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |jvdelisle at gcc dot gnu.org
            Summary|Incorrect iostat while      |Bogus END-of-line error
                   |reading SEQUENTIAL file     |with list-directed I/O of
                   |                            |file without trailing
                   |                            |sequential record marker
      Known to fail|                            |4.1.0, 4.9.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Reduced test case - fails with:
  Fortran runtime error: End of file

integer :: i
open(99, access='stream', form='unformatted')
write(99) "5 a"
close(99)

open(99, access='sequential', form='formatted')
read(99, *) i
end


The following happens. finish_list_read has:

  if (dtp->u.p.at_eol)
    {
      dtp->u.p.at_eol = 0;
      return;
    }

  err = eat_line (dtp);
  if (err == LIBERROR_END)
    hit_eof (dtp);

where eat_line has:

  do
    c = next_char (dtp);
  while (c != EOF && c != '\n');
  if (c == EOF)
    return LIBERROR_END;
  return 0;

and next_char ends with:

  dtp->u.p.at_eol = (c == '\n' || c == EOF);
  return c;

And hit_eof has:
        generate_error (&dtp->common, LIBERROR_END, NULL);


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
  2013-09-06 21:24 ` [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker burnus at gcc dot gnu.org
@ 2014-01-16 21:15 ` dominiq at lps dot ens.fr
  2014-03-13  5:22 ` jvdelisle at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-16 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-16
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r206658.


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
  2013-09-06 21:24 ` [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker burnus at gcc dot gnu.org
  2014-01-16 21:15 ` dominiq at lps dot ens.fr
@ 2014-03-13  5:22 ` jvdelisle at gcc dot gnu.org
  2014-03-15 15:12 ` jvdelisle at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-13  5:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot gnu.org

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I just got rid of the eat_line call for internal units. I did not notice this
PR until after committing the patch for pr38199.  If I remove eat_line
altogether I get regressions on file list_read tests.  I will investigate
further.


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (2 preceding siblings ...)
  2014-03-13  5:22 ` jvdelisle at gcc dot gnu.org
@ 2014-03-15 15:12 ` jvdelisle at gcc dot gnu.org
  2014-03-15 15:16 ` jvdelisle at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-15 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Mar 15 15:12:01 2014
New Revision: 208591

URL: http://gcc.gnu.org/viewcvs?rev=208591&root=gcc&view=rev
Log:
2014-03-15  Jerry DeLisle  <jvdelisle@gcc.gnu>

    PR libfortran/58324
    * io/list_read.c (finish_list_read): Read one character to check
    for the end of the file.  If it is the end, then issue the file
    end error message.  If not, use eat_line to reach the end
    without giving error.  The next attempt to read will then
    issue the error as described above.

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


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (3 preceding siblings ...)
  2014-03-15 15:12 ` jvdelisle at gcc dot gnu.org
@ 2014-03-15 15:16 ` jvdelisle at gcc dot gnu.org
  2014-03-15 20:32 ` jvdelisle at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-15 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Mar 15 15:15:22 2014
New Revision: 208592

URL: http://gcc.gnu.org/viewcvs?rev=208592&root=gcc&view=rev
Log:
2014-03-15  Jerry DeLisle  <jvdelisle@gcc.gnu>

    PR libfortran/58324
    * gfortran.dg/list_read_12.f90: New test.

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


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (4 preceding siblings ...)
  2014-03-15 15:16 ` jvdelisle at gcc dot gnu.org
@ 2014-03-15 20:32 ` jvdelisle at gcc dot gnu.org
  2014-03-15 20:35 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-15 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Mar 15 20:31:33 2014
New Revision: 208595

URL: http://gcc.gnu.org/viewcvs?rev=208595&root=gcc&view=rev
Log:
2014-03-15  Jerry DeLisle  <jvdelisle@gcc.gnu>

    Backport from mainline
    PR libfortran/58324
    PR libfortran/38199
    * io/list_read.c (finish_list_read): Read one character to check
    for the end of the file.  If it is the end, then issue the file
    end error message.  If not, use eat_line to reach the end
    without giving error.  The next attempt to read will then
    issue the error as described above.
    * io/read.c (read_decimal): Quickly skip spaces to avoid calls
    to next_char.
    * io/unit.c (is_trim_ok): New helper function to check various
    conditions to see if its OK to trim the internal unit string.
    (get_internal_unit): Use LEN_TRIM to shorten selected internal
    unit strings for optimizing READ. Enable this optimization for
    formatted READ.

Modified:
    branches/gcc-4_8-branch/libgfortran/ChangeLog
    branches/gcc-4_8-branch/libgfortran/io/list_read.c
    branches/gcc-4_8-branch/libgfortran/io/read.c
    branches/gcc-4_8-branch/libgfortran/io/unit.c


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (5 preceding siblings ...)
  2014-03-15 20:32 ` jvdelisle at gcc dot gnu.org
@ 2014-03-15 20:35 ` jvdelisle at gcc dot gnu.org
  2014-03-15 23:07 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-15 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Mar 15 20:34:58 2014
New Revision: 208596

URL: http://gcc.gnu.org/viewcvs?rev=208596&root=gcc&view=rev
Log:
2014-03-15  Jerry DeLisle  <jvdelisle@gcc.gnu>

    Backport from mainline
    PR libfortran/58324
    * gfortran.dg/list_read_12.f90: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/list_read_12.f90
Modified:
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (6 preceding siblings ...)
  2014-03-15 20:35 ` jvdelisle at gcc dot gnu.org
@ 2014-03-15 23:07 ` jvdelisle at gcc dot gnu.org
  2014-03-15 23:08 ` jvdelisle at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-15 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Mar 15 23:06:44 2014
New Revision: 208599

URL: http://gcc.gnu.org/viewcvs?rev=208599&root=gcc&view=rev
Log:
2014-03-15  Jerry DeLisle  <jvdelisle@gcc.gnu>

    Backport from mainline
    PR libfortran/58324
    PR libfortran/38199
    * intrinsics/string_intriniscs_inc.c (string_len_trim):
    Remove prototypes for string_len_trim and move to...
    * libgfortran.h (string_len_trim): ... here and
    (string_len_trim_char4): ...here.
    * io/list_read.c (finish_list_read): Read one character to check
    for the end of the file.  If it is the end, then issue the file
    end error message.  If not, use eat_line to reach the end
    without giving error.  The next attempt to read will then
    issue the error as described above.
    * io/read.c (read_decimal): Quickly skip spaces to avoid calls
    to next_char.
    * io/unit.c (is_trim_ok): New helper function to check various
    conditions to see if its OK to trim the internal unit string.
    (get_internal_unit): Use LEN_TRIM to shorten selected internal
    unit strings for optimizing READ. Enable this optimization for
    formatted READ.

    Backport from mainline
    PR libfortran/58324
    * gfortran.dg/list_read_12.f90: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/list_read_12.f90
Modified:
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/libgfortran/ChangeLog
    branches/gcc-4_7-branch/libgfortran/intrinsics/string_intrinsics_inc.c
    branches/gcc-4_7-branch/libgfortran/io/list_read.c
    branches/gcc-4_7-branch/libgfortran/io/read.c
    branches/gcc-4_7-branch/libgfortran/io/unit.c
    branches/gcc-4_7-branch/libgfortran/libgfortran.h


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (7 preceding siblings ...)
  2014-03-15 23:07 ` jvdelisle at gcc dot gnu.org
@ 2014-03-15 23:08 ` jvdelisle at gcc dot gnu.org
  2014-03-18  1:20 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-15 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

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

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Fixed and closing.


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (8 preceding siblings ...)
  2014-03-15 23:08 ` jvdelisle at gcc dot gnu.org
@ 2014-03-18  1:20 ` jvdelisle at gcc dot gnu.org
  2014-03-18  1:34 ` jvdelisle at gcc dot gnu.org
  2014-03-19  1:29 ` jvdelisle at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-18  1:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Tue Mar 18 01:20:02 2014
New Revision: 208629

URL: http://gcc.gnu.org/viewcvs?rev=208629&root=gcc&view=rev
Log:
2014-03-17  Jerry DeLisle  <jvdelisle@gcc.gnu>

    PR libfortran/58324
    * io/list_read.c (list_formatted_read_scalar): Do not use
    eat_separator. Explicitly set the comma and end-of-line flags.
    Check for END condition from finish_separator.

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


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (9 preceding siblings ...)
  2014-03-18  1:20 ` jvdelisle at gcc dot gnu.org
@ 2014-03-18  1:34 ` jvdelisle at gcc dot gnu.org
  2014-03-19  1:29 ` jvdelisle at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-18  1:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Disregard comment 11. Wrong PR number in change log.


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

* [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker
  2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
                   ` (10 preceding siblings ...)
  2014-03-18  1:34 ` jvdelisle at gcc dot gnu.org
@ 2014-03-19  1:29 ` jvdelisle at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-03-19  1:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Revision: 208629
Modified property: svn:log

Modified: svn:log at Wed Mar 19 01:28:28 2014
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Wed Mar 19 01:28:28 2014
@@ -1,6 +1,6 @@
 2014-03-17  Jerry DeLisle  <jvdelisle@gcc.gnu>

-    PR libfortran/58324
+    PR libfortran/46800
     * io/list_read.c (list_formatted_read_scalar): Do not use
     eat_separator. Explicitly set the comma and end-of-line flags.
     Check for END condition from finish_separator.


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

end of thread, other threads:[~2014-03-19  1:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-05 11:57 [Bug fortran/58324] New: Incorrect iostat while reading SEQUENTIAL file larix at libero dot it
2013-09-06 21:24 ` [Bug fortran/58324] Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker burnus at gcc dot gnu.org
2014-01-16 21:15 ` dominiq at lps dot ens.fr
2014-03-13  5:22 ` jvdelisle at gcc dot gnu.org
2014-03-15 15:12 ` jvdelisle at gcc dot gnu.org
2014-03-15 15:16 ` jvdelisle at gcc dot gnu.org
2014-03-15 20:32 ` jvdelisle at gcc dot gnu.org
2014-03-15 20:35 ` jvdelisle at gcc dot gnu.org
2014-03-15 23:07 ` jvdelisle at gcc dot gnu.org
2014-03-15 23:08 ` jvdelisle at gcc dot gnu.org
2014-03-18  1:20 ` jvdelisle at gcc dot gnu.org
2014-03-18  1:34 ` jvdelisle at gcc dot gnu.org
2014-03-19  1:29 ` jvdelisle at gcc dot gnu.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).