The attached patch fixes the failure of gfortran.dg/dtio_13.f90
on at least FreeBSD.  This test has been failing for a very long
time.  In resolve_transfer, gfortran needs to check for a BT_CLASS,
but failed to to do.  The patch allows one to remove a TODO in
dt90_13.f90 and more important the dg-error test for a spurious
error.  OK to commit?

2017-10-30  Steven G. Kargl   <ka...@gcc.gnu.org>

        * resolve.c (resolve_transfer): Set derived to correct symbol for 
        BT_CLASS.

2017-10-30  Steven G. Kargl   <ka...@gcc.gnu.org>

        * gfortran.dg/dtio_13.f90: Remove TODO comment and dg-error test.

-- 
Steve
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 254232)
+++ gcc/fortran/resolve.c	(working copy)
@@ -9181,7 +9181,7 @@ resolve_transfer (gfc_code *code)
   if (dt && dt->dt_io_kind->value.iokind != M_INQUIRE
       && (ts->type == BT_DERIVED || ts->type == BT_CLASS))
     {
-      if (ts->type == BT_DERIVED)
+      if (ts->type == BT_DERIVED || ts->type == BT_CLASS)
 	derived = ts->u.derived;
       else
 	derived = ts->u.derived->components->ts.u.derived;
Index: gcc/testsuite/gfortran.dg/dtio_13.f90
===================================================================
--- gcc/testsuite/gfortran.dg/dtio_13.f90	(revision 254232)
+++ gcc/testsuite/gfortran.dg/dtio_13.f90	(working copy)
@@ -136,9 +136,7 @@ program test
    character(3) :: a, b
    class(t) :: chairman ! { dg-error "must be dummy, allocatable or pointer" }
    open (unit=71, file='myunformatted_data.dat', form='unformatted')
-! The following error is spurious and is eliminated if previous error is corrected.
-! TODO Although better than an ICE, fix me.
-   read (71) a, chairman, b ! { dg-error "cannot be polymorphic" }
+   read (71) a, chairman, b 
    close (unit=71)
 end
 

Reply via email to