summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-01 16:22:57 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-01 16:22:57 +0000
commitebe7a403f3d5880ab10200ee0f69753d84eea215 (patch)
treee8d9448ab70a3f19bbb9217f201b291d412f9203 /libgfortran
parent9c44b3951ca82eceb9be44f16a23fbd8c30240f4 (diff)
downloadgcc-ebe7a403f3d5880ab10200ee0f69753d84eea215.tar.gz
PR libfortran/43605 Fix FTELL for formatted files
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157914 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/intrinsics.c10
2 files changed, 11 insertions, 5 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 2385b64483c..495683c5b22 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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>
PR libfortran/43265
diff --git a/libgfortran/io/intrinsics.c b/libgfortran/io/intrinsics.c
index 9428b759d15..4beb0135c86 100644
--- a/libgfortran/io/intrinsics.c
+++ b/libgfortran/io/intrinsics.c
@@ -1,8 +1,8 @@
/* Implementation of the FGET, FGETC, FPUT, FPUTC, FLUSH
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
modify it under the terms of the GNU General Public
@@ -267,10 +267,10 @@ size_t
PREFIX(ftell) (int * unit)
{
gfc_unit * u = find_unit (*unit);
- size_t ret;
+ gfc_offset ret;
if (u == NULL)
return ((size_t) -1);
- ret = (size_t) stell (u->s);
+ ret = stell (u->s) + fbuf_reset (u);
unlock_unit (u);
return ret;
}
@@ -286,7 +286,7 @@ PREFIX(ftell) (int * unit)
*offset = -1; \
else \
{ \
- *offset = stell (u->s); \
+ *offset = stell (u->s) + fbuf_reset (u); \
unlock_unit (u); \
} \
}