This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 80392: [5/6/7 Regression] ICE with allocatable polymorphic function result in a procedure pointer component


Hi all,

the attached patch fixes an ICE-on-valid regression, where the
compiler runs into an infinite loop if a derived type contains a
procedure-pointer component which has a polymorphic result of the
original type.

We already have a piece of code which prevents the infinite loop for
TYPE-valued PPCs, but it doesn't work for CLASS results, which is
fixed by the patch here.

Ok for trunk and the 5/6 branches?

Cheers,
Janus



2017-04-17  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/80392
    * trans-types.c (gfc_get_derived_type): Prevent an infinite loop when
    building a derived type that includes a procedure pointer component
    with a polymorphic result.

2017-04-17  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/80392
    * gfortran.dg/proc_ptr_comp_49.f90: New test case.

Attachment: pr80392.diff
Description: Text document

! { dg-do compile }
!
! PR 80392: [5/6/7 Regression] [OOP] ICE with allocatable polymorphic function result in a procedure pointer component
!
! Contributed by <zed.three@gmail.com>

module mwe

  implicit none

  type :: MyType
     procedure(my_op), nopass, pointer :: op
  end type

contains

  function my_op() result(foo)
    class(MyType), allocatable :: foo
  end function

end module

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