read.c (read_x): Take int argument instead of fnode * and digging the N from F->u.n.

* io/read.c (read_x): Take int argument instead of fnode * and
	digging the N from F->u.n.
	* io/io.h (read_x): Adjust prototype.
	* io/transfer.c (formatted_transfer): Adjust callers.  Don't clobber
	f->u.n for FMT_T.

	* gfortran.dg/fmt_t_1.f90: New test.

From-SVN: r103811
This commit is contained in:
Jakub Jelinek 2005-09-03 20:54:55 +02:00 committed by Jakub Jelinek
parent 7a6b752853
commit 36dd4221c5
6 changed files with 28 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2005-09-03 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/fmt_t_1.f90: New test.
2005-09-03 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/23454

View File

@ -0,0 +1,12 @@
! { dg-do run }
integer nrow, vec(15)
open (10, status="scratch")
write (10, fmt='(a)') '001 1 2 3 4 5 6'
write (10, fmt='(a)') '000000 7 8 9101112'
write (10, fmt='(a)') '000000131415'
rewind (10)
read (10, fmt='(i6, (t7, 6i2))') nrow, (vec(i), i=1,15)
close (10)
if (nrow.ne.1) call abort
if (any (vec.ne.(/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15/))) call abort
end

View File

@ -1,3 +1,11 @@
2005-09-03 Jakub Jelinek <jakub@redhat.com>
* io/read.c (read_x): Take int argument instead of fnode * and
digging the N from F->u.n.
* io/io.h (read_x): Adjust prototype.
* io/transfer.c (formatted_transfer): Adjust callers. Don't clobber
f->u.n for FMT_T.
2005-09-02 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* io/unix.c (stream_ttyname): Protect use of ttyname by

View File

@ -589,7 +589,7 @@ internal_proto(read_f);
extern void read_l (fnode *, char *, int);
internal_proto(read_l);
extern void read_x (fnode *);
extern void read_x (int);
internal_proto(read_x);
extern void read_radix (fnode *, char *, int, int);

View File

@ -831,12 +831,8 @@ read_f (fnode * f, char *dest, int length)
* and never look at it. */
void
read_x (fnode * f)
read_x (int n)
{
int n;
n = f->u.n;
if ((current_unit->flags.pad == PAD_NO || is_internal_unit ())
&& current_unit->bytes_left < n)
n = current_unit->bytes_left;

View File

@ -705,7 +705,7 @@ formatted_transfer (bt type, void *p, int len)
/* Writes occur just before the switch on f->format, above, so that
trailing blanks are suppressed. */
if (g.mode == READING)
read_x (f);
read_x (f->u.n);
break;
@ -736,10 +736,7 @@ formatted_transfer (bt type, void *p, int len)
if (g.mode == READING)
{
if (skips > 0)
{
f->u.n = skips;
read_x (f);
}
read_x (skips);
if (skips < 0)
{
move_pos_offset (current_unit->s, skips);