https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67560

            Bug ID: 67560
           Summary: False positive with -fcheck=recursion
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neil.n.carlson at gmail dot com
  Target Milestone: ---

The following example produces a runtime recursion error during finalization
with -fcheck=recursion.  There is indeed recursion, but the final subroutine is
declared recursive.

module foo
  type :: list
    type(list), pointer :: next => null()
  contains
    final :: list_delete
  end type
contains
  recursive subroutine list_delete (this)
    type(list), intent(inout) :: this
    if (associated(this%next)) deallocate(this%next)
  end subroutine
end module foo

program main
  use foo
  type(list), pointer :: x
  allocate(x)
  allocate(x%next)
  deallocate(x)
end program

Reply via email to