[Bug libfortran/92569] [8/9/10 Regression] gfortran read with end directive does not trigger with -ffrontend-optimize

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 21 20:11:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92569

--- Comment #6 from anlauf at gcc dot gnu.org ---
Something like the following fixes the testcase, but leads to regressions
elsewhere in the testsuite (e.g. direct_io_{9,10}.f):

Index: libgfortran/io/transfer.c
===================================================================
--- libgfortran/io/transfer.c   (Revision 278593)
+++ libgfortran/io/transfer.c   (Arbeitskopie)
@@ -2544,6 +2544,8 @@

   while (data)
     {
+      if (unlikely (dtp->u.p.current_unit->endfile == AFTER_ENDFILE))
+       return;
       dtp->u.p.transfer (dtp, iotype, data, kind, size, tsize);
       data += stride0 * tsize;
       count[0] += tsize;


More information about the Gcc-bugs mailing list