https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98825
--- Comment #9 from Jerry DeLisle <jvdelisle at charter dot net> --- The folowing patch fixes this and regression tests OK. diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 8ab0583dd55..27bee9d4e01 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -4020,6 +4020,8 @@ next_record_w (st_parameter_dt *dtp, int done) } } } + else if (dtp->u.p.seen_dollar == 1) + break; /* Handle legacy CARRIAGECONTROL line endings. */ else if (dtp->u.p.current_unit->flags.cc == CC_FORTRAN) next_record_cc (dtp);