public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/31532]  New: INQUIRE(...,POSITION=...) not standard conforming
@ 2007-04-10 20:34 anlauf at gmx dot de
  2007-04-10 20:36 ` [Bug libfortran/31532] " anlauf at gmx dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2007-04-10 20:34 UTC (permalink / raw)
  To: gcc-bugs

Hi,

the attached code suggests that the implementation does not
conform to the F2003 standard w.r.t. the POSITION= specifier.

The standard says:

9.9.1.22 POSITION= specifier in the INQUIRE statement

 [...]
 If the file has been repositioned since the connection, the
 scalar-default-char-variable is assigned a processor-dependent value,
 which shall not be REWIND unless the file is positioned at its
 initial point and shall not be APPEND unless the file is positioned
 so that its endfile record is the next record or at its terminal
 point if it has no endfile record.


In my interpretation of the above wording, when positioned at the
endfile record, the result should be APPEND.

The attached program shows that the current libgfortran returns ASIS
in this case.  REWIND obviously works correctly.

The test program generates and then reads a file with a single line.
After reaching the end of file, it rewinds and reads again.
The output is:

 Generating test file containing one text line

 Open file
inquire: position = ASIS      nextrec = 1
 Reading...
Read line 1 : iostat = 0
inquire: position = ASIS      nextrec = 2
Read line 2 : iostat = -1
inquire: position = ASIS      nextrec = 2

 Rewind file
inquire: position = REWIND    nextrec = 1
 Reading...
Read line 1 : iostat = 0
inquire: position = ASIS      nextrec = 2
Read line 2 : iostat = -1
inquire: position = ASIS      nextrec = 2


In both cases, after attempting to read line 2, the
INQUIRE should return position = APPEND instead of ASIS.


-- 
           Summary: INQUIRE(...,POSITION=...) not standard conforming
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2007-04-28  2:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
2007-04-10 20:36 ` [Bug libfortran/31532] " anlauf at gmx dot de
2007-04-13 14:24 ` fxcoudert at gcc dot gnu dot org
2007-04-13 23:40 ` jvdelisle at gcc dot gnu dot org
2007-04-14  2:10 ` jvdelisle at gcc dot gnu dot org
2007-04-22 17:20 ` patchapp at dberlin dot org
2007-04-28  2:03 ` jvdelisle at gcc dot gnu dot org
2007-04-28  2:04 ` jvdelisle at gcc dot gnu dot org
2007-04-28  2:13 ` 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).