aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2006-02-08 20:26:58 +0000
committerPaul Brook <paul@codesourcery.com>2006-02-08 20:26:58 +0000
commit5e642ab44d458b85bcde5b20dccbb68dbe0cd3d9 (patch)
treee07a2bd1b7a01b095e6aeb0826b1302ffb42f4be /libgfortran
parent1bbb1a67870cb029d7cf9587b4b84fd04c7a0405 (diff)
Merge from gcc-4_1-branch revision 110478.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/csl/sourcerygxx-4_1@110766 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog17
-rw-r--r--libgfortran/io/transfer.c27
2 files changed, 41 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 3c66b6f0bc0..97285426a74 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,20 @@
+2006-01-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/25835
+ * io/transfer.c (st_read_done): Flush buffers when read is done.
+
+2006-01-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/25697
+ * io/transfer.c (us_read): Detect end of file condition from previous
+ operations and bail out (no need to pre-position).
+
+2006-01-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/25631
+ * io/transfer.c (formatted_transfer_scalar): Adjust pending_spaces and
+ skips so that TL works correctly when no bytes_used yet.
+
2006-01-16 Roger Sayle <roger@eyesopen.com>
* intrinsics/c99_functions.c: Add function prototypes to avoid
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 049ebb24771..1d8330fe453 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist transfer functions contributed by Paul Thomas
@@ -868,7 +868,21 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
case FMT_TL:
case FMT_T:
if (f->format == FMT_TL)
- pos = bytes_used - f->u.n;
+ {
+
+ /* Handle the special case when no bytes have been used yet.
+ Cannot go below zero. */
+ if (bytes_used == 0)
+ {
+ dtp->u.p.pending_spaces -= f->u.n;
+ dtp->u.p.pending_spaces = dtp->u.p.pending_spaces < 0 ? 0
+ : dtp->u.p.pending_spaces;
+ dtp->u.p.skips -= f->u.n;
+ dtp->u.p.skips = dtp->u.p.skips < 0 ? 0 : dtp->u.p.skips;
+ }
+
+ pos = bytes_used - f->u.n;
+ }
else /* FMT_T */
{
consume_data_flag = 0;
@@ -1205,11 +1219,17 @@ us_read (st_parameter_dt *dtp)
int n;
gfc_offset i;
+ if (dtp->u.p.current_unit->endfile == AT_ENDFILE)
+ return;
+
n = sizeof (gfc_offset);
p = salloc_r (dtp->u.p.current_unit->s, &n);
if (n == 0)
- return; /* end of file */
+ {
+ dtp->u.p.current_unit->endfile = AT_ENDFILE;
+ return; /* end of file */
+ }
if (p == NULL || n != sizeof (gfc_offset))
{
@@ -2153,6 +2173,7 @@ export_proto(st_read_done);
void
st_read_done (st_parameter_dt *dtp)
{
+ flush(dtp->u.p.current_unit->s);
finalize_transfer (dtp);
free_format_data (dtp);
free_ionml (dtp);