PR libfortran/43605 Fix FTELL for formatted files
Co-Authored-By: Manfred Schwarb <manfred99@gmx.ch> From-SVN: r157914
This commit is contained in:
parent
5e9fb3dbde
commit
e76a3fde81
|
@ -1,3 +1,9 @@
|
||||||
|
2010-04-01 Janne Blomqvist <jb@gcc.gnu.org>
|
||||||
|
Manfred Schwarb <manfred99@gmx.ch>
|
||||||
|
|
||||||
|
PR libfortran/43605
|
||||||
|
* gfortran.dg/ftell_3.f90: New test.
|
||||||
|
|
||||||
2010-04-01 Richard Guenther <rguenther@suse.de>
|
2010-04-01 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
PR middle-end/43614
|
PR middle-end/43614
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
! { dg-do run }
|
||||||
|
! PR43605 FTELL intrinsic returns incorrect position
|
||||||
|
! Contributed by Janne Blomqvist and Manfred Schwarb
|
||||||
|
program ftell_3
|
||||||
|
integer :: i
|
||||||
|
character(len=99) :: buffer
|
||||||
|
open(10, form='formatted', status='scratch', position='rewind')
|
||||||
|
write(10, '(a)') '123456'
|
||||||
|
write(10, '(a)') '789'
|
||||||
|
write(10, '(a)') 'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'
|
||||||
|
write(10, '(a)') 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'
|
||||||
|
rewind(10)
|
||||||
|
read(10, '(a)') buffer
|
||||||
|
call ftell(10, i)
|
||||||
|
if(i /= 7) then
|
||||||
|
call abort()
|
||||||
|
end if
|
||||||
|
close(10)
|
||||||
|
end program ftell_3
|
|
@ -1,3 +1,9 @@
|
||||||
|
2010-04-01 Janne Blomqvist <jb@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR libfortran/43605
|
||||||
|
* io/intrinsics.c (ftell): Reset fbuf, correct offset.
|
||||||
|
(FTELL_SUB): Likewise.
|
||||||
|
|
||||||
2010-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
2010-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
PR libfortran/43265
|
PR libfortran/43265
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* Implementation of the FGET, FGETC, FPUT, FPUTC, FLUSH
|
/* Implementation of the FGET, FGETC, FPUT, FPUTC, FLUSH
|
||||||
FTELL, TTYNAM and ISATTY intrinsics.
|
FTELL, TTYNAM and ISATTY intrinsics.
|
||||||
Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the GNU Fortran 95 runtime library (libgfortran).
|
This file is part of the GNU Fortran runtime library (libgfortran).
|
||||||
|
|
||||||
Libgfortran is free software; you can redistribute it and/or
|
Libgfortran is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public
|
modify it under the terms of the GNU General Public
|
||||||
|
@ -267,10 +267,10 @@ size_t
|
||||||
PREFIX(ftell) (int * unit)
|
PREFIX(ftell) (int * unit)
|
||||||
{
|
{
|
||||||
gfc_unit * u = find_unit (*unit);
|
gfc_unit * u = find_unit (*unit);
|
||||||
size_t ret;
|
gfc_offset ret;
|
||||||
if (u == NULL)
|
if (u == NULL)
|
||||||
return ((size_t) -1);
|
return ((size_t) -1);
|
||||||
ret = (size_t) stell (u->s);
|
ret = stell (u->s) + fbuf_reset (u);
|
||||||
unlock_unit (u);
|
unlock_unit (u);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ PREFIX(ftell) (int * unit)
|
||||||
*offset = -1; \
|
*offset = -1; \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
*offset = stell (u->s); \
|
*offset = stell (u->s) + fbuf_reset (u); \
|
||||||
unlock_unit (u); \
|
unlock_unit (u); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue