From 802583a210c22cdbabb63d660633af09f0039a32 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sat, 3 Dec 2016 10:32:27 +0100 Subject: [PATCH] re PR fortran/58175 ([OOP] Incorrect warning message on scalar finalizer) 2016-12-03 Janus Weil PR fortran/58175 * resolve.c (gfc_resolve_finalizers): Prevent bogus warning. 2016-12-03 Janus Weil PR fortran/58175 * gfortran.dg/finalize_30.f90: Extend test case. From-SVN: r243218 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/resolve.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/finalize_30.f90 | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 68d0559..7a007c3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-12-03 Janus Weil + + PR fortran/58175 + * resolve.c (gfc_resolve_finalizers): Prevent bogus warning. + 2016-12-02 Steven G. Kargl * simplify.c (gfc_convert_char_constant): Free result on error. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 152678f..7bc9f5f 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12517,7 +12517,7 @@ error: /* Warn if we haven't seen a scalar finalizer procedure (but we know there were nodes in the list, must have been for arrays. It is surely a good idea to have a scalar version there if there's something to finalize. */ - if (warn_surprising && result && !seen_scalar) + if (warn_surprising && derived->f2k_derived->finalizers && !seen_scalar) gfc_warning (OPT_Wsurprising, "Only array FINAL procedures declared for derived type %qs" " defined at %L, suggest also scalar one", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 103906b..39a5c59 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-03 Janus Weil + + PR fortran/58175 + * gfortran.dg/finalize_30.f90: Extend test case. + 2016-12-02 Jakub Jelinek PR c++/78649 diff --git a/gcc/testsuite/gfortran.dg/finalize_30.f90 b/gcc/testsuite/gfortran.dg/finalize_30.f90 index 281bfaa..b93a3d5 100644 --- a/gcc/testsuite/gfortran.dg/finalize_30.f90 +++ b/gcc/testsuite/gfortran.dg/finalize_30.f90 @@ -10,6 +10,8 @@ module ct contains final :: aD end type + type, extends(a) :: a1 + end type contains subroutine aD(self) type(a), intent(inout) :: self -- 2.7.4