gfortran
fff.f90: In function 'foo_child':
fff.f90:26:0: internal compiler error: in gfc_conv_structure, at
fortran/trans-expr.c:4390

NAG:
Error: fff.f90, line 29: THIS is neither a POINTER nor a TARGET
       detected at PARENT@<end-of-statement>

IBM:
"Final_test.F90", line 27.20: 1514-648 (S) A structure component
reference must be polymorphic if the rightmost component name is of
abstract type.


 module parent_module
  implicit none

  type ,abstract :: parent
  contains
    procedure :: foo
  end type

contains
  subroutine foo(this)
    class(parent) :: this
    print *,'Inside parent foo'
  end subroutine
end module

module child_module
  use parent_module
  implicit none

  type ,extends(parent) :: child
  contains
    procedure :: foo => foo_child
  end type

contains
  subroutine foo_child(this)
    class(child) :: this
    class(parent) ,pointer :: this_parent=>null()
    this_parent => this%parent  ! <<<<<<<<<<<<
    print *,'Inside child foo'
    call this_parent%foo()
  end subroutine
end module


-- 
           Summary: [OOP] ICE for invalid pointer assignment  => type%parent
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43207

Reply via email to