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
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
@ 2007-04-10 20:36 ` anlauf at gmx dot de
2007-04-13 14:24 ` fxcoudert at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2007-04-10 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from anlauf at gmx dot de 2007-04-10 21:35 -------
Created an attachment (id=13351)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13351&action=view)
Test program
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
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
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-13 14:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2007-04-13 15:24 -------
(In reply to comment #0)
> 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.
I'm not too skilled at reading normative language, but I guess it only says
that if we're not at endfile, if can't be APPEND. It doesn't say that when
we're at enfile, it shall be APPEND.
Of course, there also is the quality of implementation issue to consider.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
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
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-04-13 23:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2007-04-14 00:40 -------
I have not a chance to study this yet, but I will get to it sometime soon.
--
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-04-14 00:40:43
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
` (2 preceding siblings ...)
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
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-04-14 2:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2007-04-14 03:10 -------
My interpretation of the standard as quoted in the original post.
The value of POSITION can only be APPEND if we are positioned just before the
EOF record or if there is no EOF record and the position is at it's terminating
point. In the case given, there is an EOF record, so that rules that part out.
The question then is after the first read, what is the position? The position
after the first read is just before the EOF record. So the POSITION in this
case should be APPEND.
To fix this, we can have the INQUIRE statement attempt to read one more byte.
If it is successful, we back up one byte and report ASIS. If we get an EOF
trying to read the one more byte, the we report APPEND.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
` (3 preceding siblings ...)
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
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: patchapp at dberlin dot org @ 2007-04-22 17:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from patchapp at dberlin dot org 2007-04-22 18:20 -------
Subject: Bug number PR31532
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-04/msg01415.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
` (4 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-04-28 2:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jvdelisle at gcc dot gnu dot org 2007-04-28 03:03 -------
Subject: Bug 31532
Author: jvdelisle
Date: Sat Apr 28 03:03:21 2007
New Revision: 124252
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124252
Log:
2007-04-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/31532
* io/file_pos.c (st_backspace): Set flags.position for end of file
condition and use new function update_position.
(st_endfile): Use new function update_position.
* io/io.h: Add prototype for new function.
* io/inquire.c (inquire_via_unit): If not direct access, set NEXTREC
to zero.
* io/unit.c (update_position): New function to update position info
used by inquire.
* io/transfer.c (next_record): Fix typo and use new function.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/file_pos.c
trunk/libgfortran/io/inquire.c
trunk/libgfortran/io/io.h
trunk/libgfortran/io/transfer.c
trunk/libgfortran/io/unit.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
` (5 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-04-28 2:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jvdelisle at gcc dot gnu dot org 2007-04-28 03:04 -------
Subject: Bug 31532
Author: jvdelisle
Date: Sat Apr 28 03:04:35 2007
New Revision: 124254
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124254
Log:
2007-04-27 Jerry DeLisle
PR libfortran/31532
* gfortran.dg/inquire_5.f90: Update test.
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/inquire_5.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31532
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libfortran/31532] INQUIRE(...,POSITION=...) not standard conforming
2007-04-10 20:34 [Bug libfortran/31532] New: INQUIRE(...,POSITION=...) not standard conforming anlauf at gmx dot de
` (6 preceding siblings ...)
2007-04-28 2:04 ` jvdelisle at gcc dot gnu dot org
@ 2007-04-28 2:13 ` jvdelisle at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-04-28 2:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jvdelisle at gcc dot gnu dot org 2007-04-28 03:13 -------
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=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).