diff mbox series

Fix gfortran.dg/dtio_13.f90 failure on at least FreeBSD

Message ID 20171030180525.GA66467@troutmask.apl.washington.edu
State New
Headers show
Series Fix gfortran.dg/dtio_13.f90 failure on at least FreeBSD | expand

Commit Message

Steve Kargl Oct. 30, 2017, 6:05 p.m. UTC
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   <kargl@gcc.gnu.org>

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

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

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

Comments

Paul Richard Thomas Oct. 30, 2017, 6:42 p.m. UTC | #1
Hi Steve,

It looks good to me - OK.

Thanks

Paul

On 30 October 2017 at 18:05, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> 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   <kargl@gcc.gnu.org>
>
>         * resolve.c (resolve_transfer): Set derived to correct symbol for
>         BT_CLASS.
>
> 2017-10-30  Steven G. Kargl   <kargl@gcc.gnu.org>
>
>         * gfortran.dg/dtio_13.f90: Remove TODO comment and dg-error test.
>
> --
> Steve
diff mbox series

Patch

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