diff options
Diffstat (limited to 'libgfortran/io/open.c')
-rw-r--r-- | libgfortran/io/open.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 28957673eff..d9cfde853f5 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -152,8 +152,12 @@ static const st_option async_opt[] = static void test_endfile (gfc_unit * u) { - if (u->endfile == NO_ENDFILE && ssize (u->s) == stell (u->s)) - u->endfile = AT_ENDFILE; + if (u->endfile == NO_ENDFILE) + { + gfc_offset sz = ssize (u->s); + if (sz == 0 || sz == stell (u->s)) + u->endfile = AT_ENDFILE; + } } |