[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-06 Thread jvdelisle at gcc dot gnu dot org


--- 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=gccview=revrev=142528
Log:
2008-12-06  Jerry DeLisle  [EMAIL PROTECTED]

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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-05 Thread jvdelisle at gcc dot gnu dot org


--- 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=gccview=revrev=142515
Log:
2008-12-05  Jerry DeLisle  [EMAIL PROTECTED]

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  [EMAIL PROTECTED]

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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-05 Thread jvdelisle at gcc dot gnu dot org


--- 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=gccview=revrev=142516
Log:
2008-12-05  Jerry DeLisle  [EMAIL PROTECTED]

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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-05 Thread jvdelisle at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-04 Thread jvdelisle at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-03 Thread jvdelisle at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-01 Thread jvdelisle at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-01 Thread burnus at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-12-01 Thread jvdelisle at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-11-30 Thread jvdelisle at gcc dot gnu dot org


--- 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.10POS= 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-11-30 Thread burnus at gcc dot gnu dot org


--- 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



[Bug fortran/38291] Rejects I/O with POS= if FMT=*

2008-11-27 Thread jvdelisle at gcc dot gnu dot org


--- 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|-00-00 00:00:00 |2008-11-27 14:20:54
   date||


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