This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, OOP] PR 61767: ICE in generate_finalization_wrapper at fortran/class.c:1491


Hi all,

the attached patch fixes an ice-on-valid problem with finalization.
The ICE turned out to be caused by a bug in 'has_finalizer_component':
According to the documentation, this function is supposed to detect
whether a derived type has any nonpointer nonallocatable components
that have a finalizer. However it triggered also on pointer components
with a finalizer. Fixing this makes the ICE go away.

The patch regtests cleanly on x86_64-linux-gnu. Ok for trunk?

Cheers,
Janus


2016-12-08  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/61767
    * class.c (has_finalizer_component): Fix this function to detect only
    non-pointer non-allocatable components which have a finalizer.

2016-12-08  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/61767
    * gfortran.dg/finalize_31.f90: New test.

Attachment: pr61767_v3.diff
Description: Text document

! { dg-do compile }
!
! PR 61767: [OOP] ICE in generate_finalization_wrapper at fortran/class.c:1491
!
! Contributed by <reubendb@gmail.com>

module Communicator_Form
  implicit none
  type :: CommunicatorForm
  contains
    final :: Finalize
  end type
  type :: MessageTemplate
    type ( CommunicatorForm ), pointer :: Communicator
  end type
contains
  subroutine Finalize ( C )
    type ( CommunicatorForm ) :: C
  end subroutine
end module

program p
  use Communicator_Form
  implicit none
  class ( MessageTemplate ), pointer :: M
end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]