This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, libfortran][Regression] PR43265 No EOF condition if reading with '(x)' from an empty file


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]