This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, libfortran] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: Jerry DeLisle <jvdelisle at verizon dot net>, Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 7 Jun 2009 23:00:44 +0300
- Subject: Re: [patch, libfortran] [4.4/4.5 Regression] changed BACKSPACE behaviour at end of file.
- References: <4A2AA478.6070509@verizon.net> <4A2B8777.1070102@net-b.de>
On Sun, Jun 7, 2009 at 12:25, Tobias Burnus<burnus@net-b.de> wrote:
> Jerry DeLisle wrote:
>> The following patch fixes this regression.
>> Regression tested and NIST tested on x86-64.
>> OK for trunk and 4.4.1? (with ChangeLog and a test case of course)
> Looks OK. Thanks.
>
> Tobias
>
>> Index: list_read.c
>> ===================================================================
>> --- list_read.c ? ?(revision 147996)
>> +++ list_read.c ? ?(working copy)
>> @@ -1687,6 +1687,11 @@ list_formatted_read_scalar (st_parameter
>> ? ?if (setjmp (eof_jump))
>> ? ? ?{
>> ? ? ? ?generate_error (&dtp->common, LIBERROR_END, NULL);
>> + ? ?if (!is_internal_unit (dtp))
>> + ? ? ?{
>> + ? ? ? ?dtp->u.p.current_unit->endfile = AFTER_ENDFILE;
>> + ? ? ? ?dtp->u.p.current_unit->current_record = 0;
>> + ? ? ?}
>> ? ? ? ?goto cleanup;
>> ? ? ?}
FWIW, we have the hit_eof() function so that we don't have to
duplicate EOF handling all over the place. Based on a quick look, a
call to hit_eof() could replace the generate_error call as well as all
the added lines in the patch above.
Secondly, I made a proper dejagnu testcase out of the test in the PR,
backspace_11.f90:
! { dg-do run }
! PR 40334 backspace regression
program backspace_11
implicit none
character(len=5) :: str
open(10, access='sequential', status='scratch')
write(10,'(A)')'HELLO'
rewind(10)
do
read(10,'(A)',end=1) str
enddo
1 backspace 10
!the file pointer is now at EOF
read(10,*,end=2) str
call abort
2 backspace 10
!the file pointer is now at EOF
read(10,'(A)',end=3) str
call abort
3 continue
end program backspace_11
I'll commit it as obvious when I'll get back home to my usual
development machine, unless somebody objects.
--
Janne Blomqvist