diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-30 15:12:37 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-30 15:12:37 +0000 |
commit | 7ee4f67a4372ce1c2a9ef5510a6a6de4d55eb540 (patch) | |
tree | 164be18da851f117899e247478ee56e7245b26dc /libgfortran/io/intrinsics.c | |
parent | f274e293da2a206765d9449aa09bf6c64ce1a9c1 (diff) | |
download | gcc-7ee4f67a4372ce1c2a9ef5510a6a6de4d55eb540.tar.gz |
Fix PR libfortran/39667
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147004 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/intrinsics.c')
-rw-r--r-- | libgfortran/io/intrinsics.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/io/intrinsics.c b/libgfortran/io/intrinsics.c index 0a894aac43e..0e33e8490da 100644 --- a/libgfortran/io/intrinsics.c +++ b/libgfortran/io/intrinsics.c @@ -46,6 +46,13 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len) if (u == NULL) return -1; + fbuf_reset (u); + if (u->mode == WRITING) + { + sflush (u->s); + u->mode = READING; + } + memset (c, ' ', c_len); ret = sread (u->s, c, 1); unlock_unit (u); @@ -118,6 +125,13 @@ PREFIX(fputc) (const int * unit, char * c, if (u == NULL) return -1; + fbuf_reset (u); + if (u->mode == READING) + { + sflush (u->s); + u->mode = WRITING; + } + s = swrite (u->s, c, 1); unlock_unit (u); if (s < 0) |