Hi all, attached is a small patch which fixes an ICE-on-invalid regression with finalization. In the PR, Dominique objected to the patch, but I think it's the correct thing to do after all. The line that I'm removing was added in a patch authored by Tobias and myself. I suspect it was added to work around some other problem in the finalization implementation, and there is no evidence it's actually needed.
The patch regtests cleanly on x86_64-unknown-linux-gnu. Ok for trunk? Cheers, Janus 2014-02-06 Janus Weil <ja...@gcc.gnu.org> PR fortran/58470 * resolve.c (resolve_fl_derived0): Remove unnecessary call to gfc_is_finalizable. 2014-02-06 Janus Weil <ja...@gcc.gnu.org> PR fortran/58470 * gfortran.dg/finalize_22.f90: New.
Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 207485) +++ gcc/fortran/resolve.c (working copy) @@ -12455,10 +12455,6 @@ resolve_fl_derived0 (gfc_symbol *sym) /* Add derived type to the derived type list. */ add_dt_to_dt_list (sym); - /* Check if the type is finalizable. This is done in order to ensure that the - finalization wrapper is generated early enough. */ - gfc_is_finalizable (sym, NULL); - return true; }
! { dg-do compile } ! ! PR 58470: [4.9 Regression] [OOP] ICE on invalid with FINAL procedure and type extension ! ! Contributed by Andrew Benson <abenso...@gmail.com> module cf type :: cfml contains final :: mld end type cfml type, extends(cfml) :: cfmde end type cfmde contains subroutine mld(s) ! { dg-error "must be of type" } class(cfml), intent(inout) :: s end subroutine mld end module cf ! { dg-final { cleanup-modules "cf" } }