Hi all,
The attached patch fixes this by avoiding looking for and avoiding the
EOF condition in the parent READ after returning from the child IO process.
I could not think of a simple test case yet since the problem occurred
only when redirecting the input to the test program via a pipe. If I
have some more time today I will try to come up with something.
OK for mainline?
Jerry
commit e6fa9d84cf126630c9ea744aabec6d7715087310 (HEAD -> master)
Author: Jerry DeLisle <jvdeli...@gcc.gnu.org>
Date: Sun Jul 21 19:19:00 2024 -0700
Fortran: Suppress wrong End Of File error with user defined IO.
libgfortran/ChangeLog:
PR libfortran/105361
* io/list_read.c (finish_list_read): Add a condition check for
a user defined derived type IO operation to avoid calling the
EOF error.
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 5bbbef26c26..96b2efe854f 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2431,7 +2431,8 @@ finish_list_read (st_parameter_dt *dtp)
/* Set the next_char and push_char worker functions. */
set_workers (dtp);
- if (likely (dtp->u.p.child_saved_iostat == LIBERROR_OK))
+ if (likely (dtp->u.p.child_saved_iostat == LIBERROR_OK)
+ && ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0))
{
c = next_char (dtp);
if (c == EOF)