public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38291] New: Rejects I/O with POS= if FMT=*
@ 2008-11-27 13:57 burnus at gcc dot gnu dot org
2008-11-27 14:22 ` [Bug fortran/38291] " jvdelisle at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-27 13:57 UTC (permalink / raw)
To: gcc-bugs
Found at
http://de.wikibooks.org/wiki/Fortran:_Fortran_2003:_Ein-_und_Ausgabe
The following is valid and the error message is bogus:
read( 50, *, pos = 1 )
1
Error: FMT=* is not allowed with a REC= specifier at (1).
open(50,access='stream')
read( 50, *, pos = 1 )
end
--
Summary: Rejects I/O with POS= if FMT=*
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
@ 2008-11-27 14:22 ` jvdelisle at gcc dot gnu dot org
2008-12-01 3:57 ` jvdelisle at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-11-27 14:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jvdelisle at gcc dot gnu dot org 2008-11-27 14:20 -------
I am on it.
--
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 |2008-11-27 14:20:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
2008-11-27 14:22 ` [Bug fortran/38291] " jvdelisle at gcc dot gnu dot org
@ 2008-12-01 3:57 ` jvdelisle at gcc dot gnu dot org
2008-12-01 6:45 ` burnus 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 @ 2008-12-01 3:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jvdelisle at gcc dot gnu dot org 2008-12-01 03:55 -------
read( 50, *, pos = 1 )
is valid only if the unit has been connected for STREAM access. F2003
"9.5.1.10 POS= specifier in a data transfer statement
The POS= specifier specifies the file position in file storage units. This
specifier may appear in a data transfer statement only if the statement
specifies a unit connected for stream access. A child data transfer statement
shall not specify this specifier."
So the read statement by itself is invalid. However, we should generate better
error message for this case. I have a patch on the way.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
2008-11-27 14:22 ` [Bug fortran/38291] " jvdelisle at gcc dot gnu dot org
2008-12-01 3:57 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-01 6:45 ` burnus at gcc dot gnu dot org
2008-12-01 16:33 ` jvdelisle at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-12-01 6:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2008-12-01 06:44 -------
> read( 50, *, pos = 1 )
> is valid only if the unit has been connected for STREAM access.
Well, (a) I don't see how this can be tested at compile time and (b) I thought
that
open(50,access='stream')
is doing so.
> So the read statement by itself is invalid.
???
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-12-01 6:45 ` burnus at gcc dot gnu dot org
@ 2008-12-01 16:33 ` jvdelisle at gcc dot gnu dot org
2008-12-01 16:41 ` burnus at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-12-01 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2008-12-01 16:32 -------
> So the read statement by itself is invalid.
???
I was testing with and without the open statement in the test case and saw that
we were not catching that error either. Regardless, the problem is that I was
using dt->rec instead of dt->pos and our runtime just defaulted to using the
dt-rec for stream I/O. This fix is that we have to use dt->pos in the matchers
and actually test conditions for pos= instead of rec= .
I will post the patch tonight.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-12-01 16:33 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-01 16:41 ` burnus at gcc dot gnu dot org
2008-12-02 5:37 ` jvdelisle at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-12-01 16:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2008-12-01 16:40 -------
(In reply to comment #4)
> > > So the read statement by itself is invalid.
> > ???
>
> I was testing with and without the open statement in the test case and saw
> that we were not catching that error either.
Ah, you are also talking about the run-time check in the library and not only
about the compile-time check in f951.
> I will post the patch tonight.
Thanks a ton!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-12-01 16:41 ` burnus at gcc dot gnu dot org
@ 2008-12-02 5:37 ` jvdelisle at gcc dot gnu dot org
2008-12-04 5:34 ` 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 @ 2008-12-02 5:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jvdelisle at gcc dot gnu dot org 2008-12-02 05:35 -------
Patch submitted. There is ABI breakage with 4.3 in that patch I noticed after
I submitted, so I am now testing some tweaks.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-12-02 5:37 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-04 5:34 ` jvdelisle at gcc dot gnu dot org
2008-12-05 5: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 @ 2008-12-04 5:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jvdelisle at gcc dot gnu dot org 2008-12-04 05:32 -------
I am holding off on committing the patch.
With this test case I have found a nasty problem:
! { dg-do run }
! PR38291 Rejects I/O with POS= if FMT=*
character(15) :: sAccess
character(1) :: instr
open(50, access="stream", form="formatted")
write(50, *, pos=1) "Just something"
read( 50, *,pos=7)
inquire(50, access=sAccess)
if (sAccess.ne."STREAM") call abort
close(50,status="delete")
end
With the patch submitted to list, I get unstable execution. Sometimes errors
with -m32, sometimes with -m64, Sometimes one execution to the next. I do not
know if this is a latent bug or one introduced by the patch. I suspect latent
because this is the first time we actually are using dtp->pos even though it
has been in the dtp structure. Here is a sample output:
$ gfc streamio_16.f90
$ ./a.out
At line 7 of file streamio_16.f90 (unit = 50, file = 'fort.50')
Fortran runtime error: End of file
$ ./a.out
$ ./a.out
At line 7 of file streamio_16.f90 (unit = 50, file = 'fort.50')
Fortran runtime error: End of file
$ ./a.out
$ ./a.out
At line 7 of file streamio_16.f90 (unit = 50, file = 'fort.50')
Fortran runtime error: End of file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-12-04 5:34 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-05 5:40 ` jvdelisle at gcc dot gnu dot org
2008-12-06 4:16 ` 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 @ 2008-12-05 5:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jvdelisle at gcc dot gnu dot org 2008-12-05 05:39 -------
The alternating error was an artefact of the test case and not part of the bug.
I have submitted a fixed patch that eliminates the incorrect EOF error. I
will commit soon.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-12-05 5:40 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-06 4:16 ` jvdelisle at gcc dot gnu dot org
2008-12-06 4:20 ` 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 @ 2008-12-06 4:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jvdelisle at gcc dot gnu dot org 2008-12-06 04:15 -------
Subject: Bug 38291
Author: jvdelisle
Date: Sat Dec 6 04:13:34 2008
New Revision: 142515
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142515
Log:
2008-12-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/38291
* io.c (match_dt_element): Use dt->pos in matcher.
(gfc_free_dt): Free dt->pos after use.
(gfc_resolve_dt): Use dt->pos in resolution of stream position tag.
2008-12-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/38291
* io/transfer.c (data_transfer_init): Add checks for POS= valid range.
Add check for unit opened with ACCESS="stream". Flush and seek if
current stream position does not match. Check ENDFILE on read.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/io.c
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/transfer.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (8 preceding siblings ...)
2008-12-06 4:16 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-06 4:20 ` jvdelisle at gcc dot gnu dot org
2008-12-06 4:25 ` jvdelisle at gcc dot gnu dot org
2008-12-06 21:55 ` jvdelisle at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-12-06 4:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jvdelisle at gcc dot gnu dot org 2008-12-06 04:19 -------
Subject: Bug 38291
Author: jvdelisle
Date: Sat Dec 6 04:17:31 2008
New Revision: 142516
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142516
Log:
2008-12-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/38291
* gfortran.dg/streamio_16.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/streamio_16.f90
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (9 preceding siblings ...)
2008-12-06 4:20 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-06 4:25 ` jvdelisle at gcc dot gnu dot org
2008-12-06 21:55 ` jvdelisle at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-12-06 4:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jvdelisle at gcc dot gnu dot org 2008-12-06 04:19 -------
Fixed on trunk.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/38291] Rejects I/O with POS= if FMT=*
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
` (10 preceding siblings ...)
2008-12-06 4:25 ` jvdelisle at gcc dot gnu dot org
@ 2008-12-06 21:55 ` jvdelisle at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-12-06 21:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jvdelisle at gcc dot gnu dot org 2008-12-06 21:54 -------
Subject: Bug 38291
Author: jvdelisle
Date: Sat Dec 6 21:53:11 2008
New Revision: 142528
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142528
Log:
2008-12-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/38291
* io/transfer.c (data_transfer_init): Add fbuf_flush inadvertently
ommitted. Add check for invalid use of REC= with ACCESS="stream". Fix
comment.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/transfer.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38291
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-12-06 21:55 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-27 13:57 [Bug fortran/38291] New: Rejects I/O with POS= if FMT=* burnus at gcc dot gnu dot org
2008-11-27 14:22 ` [Bug fortran/38291] " jvdelisle at gcc dot gnu dot org
2008-12-01 3:57 ` jvdelisle at gcc dot gnu dot org
2008-12-01 6:45 ` burnus at gcc dot gnu dot org
2008-12-01 16:33 ` jvdelisle at gcc dot gnu dot org
2008-12-01 16:41 ` burnus at gcc dot gnu dot org
2008-12-02 5:37 ` jvdelisle at gcc dot gnu dot org
2008-12-04 5:34 ` jvdelisle at gcc dot gnu dot org
2008-12-05 5:40 ` jvdelisle at gcc dot gnu dot org
2008-12-06 4:16 ` jvdelisle at gcc dot gnu dot org
2008-12-06 4:20 ` jvdelisle at gcc dot gnu dot org
2008-12-06 4:25 ` jvdelisle at gcc dot gnu dot org
2008-12-06 21:55 ` 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).