This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, libfortran][Regression] PR43265 No EOF condition if reading with '(x)' from an empty file
- From: Tobias Burnus <burnus at net-b dot de>
- To: Jerry DeLisle <jvdelisle at verizon dot net>
- Cc: gfortran list <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 08 Mar 2010 10:32:57 +0100
- Subject: Re: [patch, libfortran][Regression] PR43265 No EOF condition if reading with '(x)' from an empty file
- References: <4B948C40.4070707@verizon.net>
On 03/08/2010 06:33 AM, Jerry DeLisle wrote:
> The attached patch fixes this PR by extracting the code in read_sf
> used by
> read_x and putting it into read_x.
Why do you allocate for
+ if (is_internal_unit (dtp))
+ {
+ p = mem_alloc_r (dtp->u.p.current_unit->s, &length);
+ if (unlikely (length < n))
+ n = length;
+ goto done;
+ }
As you do not read anything with the X edit descriptor, you shouldn't
need this...
* * *
Related to the bugreport, though slightly different: The following
program compiles & runs with NAG f95, ifort, and Open64, but shows an
EOF error with gfortran:
character(len=2) str
str = ''
read(str(1:0), '(T7,i1)') i
if (i /= 0) stop 'ABORT'
end
Ditto for:
character(len=2) str
str = ''
open(99,file='test.dat',access='stream',form='unformatted')
write(99) ' '
close(99)
open(99,file='test.dat')
read(99, '(T7,i1)') i
close(99, status='delete')
if (i /= 0) stop 'ABORT'
end
Tobias