[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-29 Thread jvdelisle at gcc dot gnu dot org


--- Comment #29 from jvdelisle at gcc dot gnu dot org  2010-03-30 03:22 
---
Subject: Bug 43265

Author: jvdelisle
Date: Tue Mar 30 03:22:28 2010
New Revision: 157810

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157810
Log:
2010-03-29  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* io/transfer.c (next_record_r): Only call hit_eof for specific
conditions when an EOF is encountered.

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


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-29 Thread jvdelisle at gcc dot gnu dot org


--- Comment #30 from jvdelisle at gcc dot gnu dot org  2010-03-30 03:25 
---
Subject: Bug 43265

Author: jvdelisle
Date: Tue Mar 30 03:25:04 2010
New Revision: 157811

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157811
Log:
2010-03-29  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* gfortran.dg/read_eof_8.f90: New test.

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


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-29 Thread jvdelisle at gcc dot gnu dot org


--- Comment #31 from jvdelisle at gcc dot gnu dot org  2010-03-30 03:54 
---
Subject: Bug 43265

Author: jvdelisle
Date: Tue Mar 30 03:54:36 2010
New Revision: 157812

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157812
Log:
2010-03-29  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* io/transfer.c (next_record_r): Only call hit_eof for specific
conditions when an EOF is encountered.

Modified:
branches/gcc-4_4-branch/libgfortran/ChangeLog
branches/gcc-4_4-branch/libgfortran/io/transfer.c


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-29 Thread jvdelisle at gcc dot gnu dot org


--- Comment #32 from jvdelisle at gcc dot gnu dot org  2010-03-30 03:56 
---
Subject: Bug 43265

Author: jvdelisle
Date: Tue Mar 30 03:56:08 2010
New Revision: 157813

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157813
Log:
2010-03-29  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* gfortran.dg/read_eof_8.f90: New test.

Added:
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/read_eof_8.f90
Modified:
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-29 Thread jvdelisle at gcc dot gnu dot org


--- Comment #33 from jvdelisle at gcc dot gnu dot org  2010-03-30 03:57 
---
Closing one more time.  Fixed on trunk and 4.4


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-28 Thread jvdelisle at gcc dot gnu dot org


--- Comment #26 from jvdelisle at gcc dot gnu dot org  2010-03-29 02:50 
---
Reopening.  I have one more regression here related to the patch sequence here.

It has to do with reading a file with no EOR marker at the end of a file.

program test
 character (len=80) :: line
 character (len=20) :: filename
 integer :: n, k=0
 n = command_argument_count()
 if (n  0) then
call get_command_argument(1,filename)
else
   stop 'argument missing'
endif
 open(unit=25,file=filename,status='old')
 do
read(25,'(a80)',end=100,err=101) line
k = k+1
print*,k,' : ',line(1:len_trim(line))
 enddo
stop ok
100 stop 100
101 stop 101
end program test

I know the exact location of the problem in transfer.c (next_record_r) and am
working on a patch.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #19 from jvdelisle at gcc dot gnu dot org  2010-03-18 02:38 
---
Subject: Bug 43265

Author: jvdelisle
Date: Thu Mar 18 02:38:17 2010
New Revision: 157527

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157527
Log:
2010-03-17  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* io/io.h: Delete prototype for read_sf, making it static.
* io/read.c (read_x): Modify to call hit_eof if PAD=no.
* io/transfer.c (read_sf_internal): New static function extracted from
read_sf for use on internal units only. Handle empty string case.
(read_sf): New factoring of this function, make it static.  Add special
conditions for EOF based on ADVANCE=no, PAD=no, and whether any
bytes have been previously read from the record.
(read_block_form): Modify to call read_sf or read_sf_internal.
(next_record_r): Add a done flag similar to next_record_w. Call hit_eof
if internal array unit next record returns finished, meaning an EOF was
found and not done, ie not the last record expected.  For external
units call hit_eof if item_count is 1 or there are no pending spaces.
(next_record): Update call to next_record_r.

Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/io.h
trunk/libgfortran/io/read.c
trunk/libgfortran/io/transfer.c


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #20 from jvdelisle at gcc dot gnu dot org  2010-03-18 02:43 
---
Subject: Bug 43265

Author: jvdelisle
Date: Thu Mar 18 02:43:10 2010
New Revision: 157528

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157528
Log:
2010-03-17  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
*gfortran.dg/read_empty_file.f: New test.
*gfortran.dg/read_eof_all.f90: New test.
*gfortran.dg/namelist_27.f90: Eliminate infinite loop posibility.
*gfortran.dg/namelist_28.f90: Eliminate infinite loop posibility.

Added:
trunk/gcc/testsuite/gfortran.dg/read_empty_file.f
trunk/gcc/testsuite/gfortran.dg/read_eof_all.f90
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/namelist_27.f90
trunk/gcc/testsuite/gfortran.dg/namelist_28.f90


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #21 from jvdelisle at gcc dot gnu dot org  2010-03-18 02:52 
---
The above patches take care of several other corner cases with end file
conditions. Thanks Terry for report and Tobias for helping with test cases.

I am not proceeding to back port to 4.4.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #22 from jvdelisle at gcc dot gnu dot org  2010-03-18 02:54 
---
Correction s/not/now 


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #23 from jvdelisle at gcc dot gnu dot org  2010-03-18 03:52 
---
Subject: Bug 43265

Author: jvdelisle
Date: Thu Mar 18 03:51:43 2010
New Revision: 157532

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157532
Log:
2010-03-17  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* io/io.h: Delete prototype for read_sf, making it static.
* io/read.c (read_x): Modify to call hit_eof if PAD=no.
* io/transfer.c (read_sf_internal): New static function extracted from
read_sf for use on internal units only. Handle empty string case.
(read_sf): New factoring of this function, make it static.  Add special
conditions for EOF based on ADVANCE=no, PAD=no, and whether any
bytes have been previously read from the record.
(read_block_form): Modify to call read_sf or read_sf_internal.
(next_record_r): Add a done flag similar to next_record_w. Call hit_eof
if internal array unit next record returns finished, meaning an EOF was
found and not done, ie not the last record expected.  For external
units call hit_eof if item_count is 1 or there are no pending spaces.
(next_record): Update call to next_record_r.

Modified:
branches/gcc-4_4-branch/libgfortran/ChangeLog
branches/gcc-4_4-branch/libgfortran/io/io.h
branches/gcc-4_4-branch/libgfortran/io/read.c
branches/gcc-4_4-branch/libgfortran/io/transfer.c


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #24 from jvdelisle at gcc dot gnu dot org  2010-03-18 03:56 
---
Subject: Bug 43265

Author: jvdelisle
Date: Thu Mar 18 03:55:52 2010
New Revision: 157533

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157533
Log:
2010-03-17  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
*gfortran.dg/read_empty_file.f: New test.
*gfortran.dg/read_eof_all.f90: New test.
*gfortran.dg/namelist_27.f90: Eliminate infinite loop posibility.
*gfortran.dg/namelist_28.f90: Eliminate infinite loop posibility.

Added:
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/read_empty_file.f
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/read_eof_all.f90
Modified:
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/namelist_27.f90
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/namelist_28.f90


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-17 Thread jvdelisle at gcc dot gnu dot org


--- Comment #25 from jvdelisle at gcc dot gnu dot org  2010-03-18 03:58 
---
IO library is significantly changed from 4.3 to 4.4/4.5 No Backport to 4.3

Closing.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

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


--- Comment #17 from jvdelisle at gcc dot gnu dot org  2010-03-12 14:32 
---
Subject: Bug 43265

Author: jvdelisle
Date: Fri Mar 12 14:32:39 2010
New Revision: 157404

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157404
Log:
2010-03-12  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
Backport from trunk.
* io/read.c (read_x): Replace the use of read_sf with equivalent lower
level I/O, eliminating unneeded code and handling EOF and EOR
conditions.
* io/io.h: Revise prototype for read_sf.
* io/transfer.c (read_sf): Delete no_error parameter and all uses of
it.
Set eof and eor condition flags. (read_block_form): Likewise.
(next_record_r): Add condition to call to hit_eof.

Modified:
branches/gcc-4_4-branch/libgfortran/ChangeLog
branches/gcc-4_4-branch/libgfortran/io/io.h
branches/gcc-4_4-branch/libgfortran/io/read.c
branches/gcc-4_4-branch/libgfortran/io/transfer.c


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

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


--- Comment #18 from jvdelisle at gcc dot gnu dot org  2010-03-12 14:36 
---
Subject: Bug 43265

Author: jvdelisle
Date: Fri Mar 12 14:36:16 2010
New Revision: 157405

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157405
Log:
2010-03-12  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43320
PR libfortran/43265
* gfortran.dg/read_eof_6.f: New test
* gfortran.dg/read_x_eof.f90: New test.
* gfortran.dg/read_x_past.f: Update test.

Added:
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/read_eof_6.f
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/read_x_eof.f90
Modified:
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/read_x_past.f


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-10 Thread burnus at gcc dot gnu dot org


--- Comment #15 from burnus at gcc dot gnu dot org  2010-03-10 12:42 ---
This patch causes a regression in SPEC CPU 2000 (200.sixtrack), see PR 43320.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-10 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P4


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-10 Thread jvdelisle at gcc dot gnu dot org


--- Comment #16 from jvdelisle at gcc dot gnu dot org  2010-03-11 02:26 
---
Subject: Bug 43265

Author: jvdelisle
Date: Thu Mar 11 02:26:36 2010
New Revision: 157378

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157378
Log:
2010-03-10  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43320
PR libfortran/43265
* gfortran.dg/read_eof_6.f: New test
* gfortran.dg/read_x_eof.f90: Update test.
* gfortran.dg/read_x_past.f: Update test.

Added:
trunk/gcc/testsuite/gfortran.dg/read_eof_6.f
trunk/gcc/testsuite/gfortran.dg/read_x_eof.f90
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/read_x_past.f


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-09 Thread burnus at gcc dot gnu dot org


--- Comment #13 from burnus at gcc dot gnu dot org  2010-03-09 15:36 ---
(In reply to comment #11)
 Regarding the additional test cases given here:
 http://gcc.gnu.org/ml/fortran/2010-03/msg00037.html
 
 I do believe that gfortran has this correct. [...]

I believe otherwise and thus think a follow up patch is needed, which covers
the related but different issues, cf.
http://gcc.gnu.org/ml/fortran/2010-03/msg00046.html

(I think the patch in for this PR (comment 10) is fine and thus I approved it.)

Do you plan to backport the patch to 4.4? (Probably not to 4.3, I'd guess.)


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-09 Thread jvdelisle at gcc dot gnu dot org


--- Comment #12 from jvdelisle at gcc dot gnu dot org  2010-03-09 14:41 
---
Subject: Bug 43265

Author: jvdelisle
Date: Tue Mar  9 14:41:17 2010
New Revision: 157310

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157310
Log:
2010-03-09  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/43265
* io/read.c: Include fbuf.h and unix.h to enable lower level I/O for
read_x. (read_x): Replace the use of read_sf with equivalent lower
level
I/O, eliminating unneeded code and handling EOF and EOR conditions.
* io/io.h: Revise prototype for read_sf.
* io/transfer.c (read_sf): Delete no_error parameter and all uses of
it.
(read_block_form): Likewise.
(next_record_r): Delete wrong code call to hit_eof.

Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/io.h
trunk/libgfortran/io/read.c
trunk/libgfortran/io/transfer.c


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-09 Thread jvdelisle at gcc dot gnu dot org


--- Comment #14 from jvdelisle at gcc dot gnu dot org  2010-03-09 20:13 
---
Yes, I will backport to 4.4 in a few days.

Regarding a followup patch.  There are differences between internal units and
how padding is handled and external units.  I am certain we have crossed this
question before. This is why I have done nothing about it so far.

I agree to look into it and report back here.

BTW Thanks Terry for reporting the original bug here.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-08 Thread jvdelisle at gcc dot gnu dot org


--- Comment #11 from jvdelisle at gcc dot gnu dot org  2010-03-08 20:19 
---
Regarding the additional test cases given here:

http://gcc.gnu.org/ml/fortran/2010-03/msg00037.html

I do believe that gfortran has this correct.  You are not allowed to attempt to
read from a location past the end of the file.  You can try to tab there and do
nothing, but as soon as you attempt to read, it is an EOF codition.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-06 Thread burnus at gcc dot gnu dot org


--- Comment #10 from burnus at gcc dot gnu dot org  2010-03-06 09:49 ---
In terms of the standard, probably everything is OK for I/O: The set of
input/output error conditions is processor dependent. (See 9.11.1 General
for a non-definition when EOF occurs.)

Looking at other compilers:

* If X is the only edit descriptor and there is no EOR marker left in the
input buffer (i.e. no '\n'), an End Of File error occurs. (gfortran: No error -
this PR)

* If one reads, e.g. i2 from a record where either only a record marker
follows or only the end-of-file, one reads the value 0 and no error occurs.
(gfortran: No error if record marker follows, but error if only eof follows.
Note that reading '(a)' from aeof does not give an error while reading from
eof gives an error.)

* If one reads (i2,100x,i2,100x) or (100x,2i2) from a record, one gets two
0 and no error, independent whether the record buffer contains eof,
eoreof or   eof. (gfortran: If there is a record marker, the result
is the same; otherwise an EOF error occurs, unless two integer values could be
read - then the trailing 100x does not cause any error.)

I think the result of the other compilers is sensible.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread burnus at gcc dot gnu dot org


--- Comment #1 from burnus at gcc dot gnu dot org  2010-03-05 09:07 ---
Jerry, can you have a look?

With gfortran 4.1 and 4.2, g95, ifort, openf95, and NAG f95 the program
immediately returns with ended. However, in gfortran 4.3, 4.4, and 4.5 it
simply loops through without hitting end=.

Using *  instead of  (x)  as fmt, I get immediately an End of File - as
expected. (In my case, there was no file and OPEN created an empty one.)


In a way it is not surprising. In io/read.c:

  read_x (st_parameter_dt * dtp, int n)
[...]
  read_sf (dtp, n, 1);

and then in io/transfer.c:

  read_sf (st_parameter_dt *dtp, int * length, int no_error)
[...]
/* If we hit EOF previously with the no_error flag set (i.e. X, T,
   TR edit descriptors), and we now try to read again, this time
   without setting no_error.  */
if (!no_error  dtp-u.p.at_eof)
  {
*length = 0;
hit_eof (dtp);
return NULL;
  }
[...]
base = p = fbuf_read (dtp-u.p.current_unit, length);
if (base == NULL)
  return NULL;


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   GCC host triplet|i686-pc-linux-gnu   |
   Keywords||wrong-code
  Known to fail||4.3.4 4.4.4 4.5.0
  Known to work||4.1.2 4.2.1
   Last reconfirmed|-00-00 00:00:00 |2010-03-05 09:07:49
   date||
Summary|Read no longer jumps on end |[4.3/4.4/4.5 Regression] No
   ||EOF condition if reading
   ||with '(x)' from an empty
   ||file
   Target Milestone|--- |4.4.4


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread hjl dot tools at gmail dot com


--- Comment #2 from hjl dot tools at gmail dot com  2010-03-05 17:02 ---
It is caused by revision 123038:

http://gcc.gnu.org/ml/gcc-cvs/2007-03/msg00628.html


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread burnus at gcc dot gnu dot org


--- Comment #3 from burnus at gcc dot gnu dot org  2010-03-05 18:07 ---
(In reply to comment #2)
 It is caused by revision 123038:
 http://gcc.gnu.org/ml/gcc-cvs/2007-03/msg00628.html

Which was a fix for PR 31052:
  Bad IOSTAT values when readings NAMELISTs past EOF


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread jvdelisle at gcc dot gnu dot org


--- Comment #4 from jvdelisle at gcc dot gnu dot org  2010-03-05 23:06 
---
Mine, hmm almost exactly three years ago.


-- 

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|NEW |ASSIGNED
   Last reconfirmed|2010-03-05 09:07:49 |2010-03-05 23:06:54
   date||


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread jvdelisle at gcc dot gnu dot org


--- Comment #5 from jvdelisle at gcc dot gnu dot org  2010-03-06 01:07 
---
And this:

Index: read.c
===
--- read.c  (revision 157247)
+++ read.c  (working copy)
@@ -1030,7 +1030,7 @@

   dtp-u.p.sf_read_comma = 0;
   if (n  0)
-read_sf (dtp, n, 1);
+read_sf (dtp, n, 0);
   dtp-u.p.sf_read_comma = 1;
   dtp-u.p.current_unit-strm_pos += (gfc_offset) n;
 }

Fixes it, however gfortran.dg/read_x_past.f would fail.  Tobias can you see how
other compilers handle read_x_past.f?  I am wondering if my previous
interpretations are incorrect.

Also the F95 standard says in 10.6.1:

The position specified by an X edit descriptor is forward from the current
position. On input, a position beyond the last character of the record may be
specified if no characters are transmitted from such positions.

This to me means there is no END condition if there is no transfer after the X.
I am wondering of this should be an extension, give the END condition with
-std=gnu and not with -std=f95? Also, perhaps we should discuss on c.l.f.

Obviously it is useful to give this end and not unreasonable, but this
contradicts the pr26661 conclusion, or at least we must determine another
approach.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread jvdelisle at gcc dot gnu dot org


--- Comment #6 from jvdelisle at gcc dot gnu dot org  2010-03-06 03:32 
---
Standby folks.  This problem has nothing to do with

/* If we hit EOF previously with the no_error flag set (i.e. X, T,
   TR edit descriptors), and we now try to read again, this time
   without setting no_error.  */
if (!no_error  dtp-u.p.at_eof)
  {
*length = 0;
hit_eof (dtp);
return NULL;
  }

That block of code is never executed for either test case. It may even be dead
code.  Stay tuned.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread terry at chem dot gu dot se


--- Comment #7 from terry at chem dot gu dot se  2010-03-06 03:36 ---
Subject: Re:  [4.3/4.4/4.5 Regression] No EOF condition 
 if reading with '(x)' from an empty file


 Also the F95 standard says in 10.6.1:

 The position specified by an X edit descriptor is forward from the
 current
 position. On input, a position beyond the last character of the record may
 be
 specified if no characters are transmitted from such positions.

 This to me means there is no END condition if there is no transfer after
 the X.
 I am wondering of this should be an extension, give the END condition with
 -std=gnu and not with -std=f95? Also, perhaps we should discuss on c.l.f.


Should I interpret that as being that the code I presented currently
behaves in a way consistent with the F95 standard?  (Any differences here
with the F90 or F77 standards?)

It seems that's a critical question, irrespective of any principle of
least surprise.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread jvdelisle at gcc dot gnu dot org


--- Comment #8 from jvdelisle at gcc dot gnu dot org  2010-03-06 03:54 
---
Terry,

I will see if the other standards address this or say something different. I
would not conclude anything yet about your code.  What I can conclude is we
have a real bug regardless. We should not have dead code and what it is doing
is not consistent with what I expected.


-- 


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



[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file

2010-03-05 Thread jvdelisle at gcc dot gnu dot org


--- Comment #9 from jvdelisle at gcc dot gnu dot org  2010-03-06 05:29 
---
The F77, F95, F2003, and F2008 candidate draft all have the exact same wording
as given in Comment #5.


-- 


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