This is the mail archive of the gcc-bugs@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]

[Bug fortran/70601] New: [OOP] ICE on procedure pointer component call


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

            Bug ID: 70601
           Summary: [OOP] ICE on procedure pointer component call
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zmi007 at gmail dot com
  Target Milestone: ---

I am playing around with procedure pointer components and get ICE 

module_gfortran_bug.f90:62:0:

    call concrete % run()

internal compiler error: in fold_convert_loc, at fold-const.c:2256

on the following code with gfortran-6 [trunk revision 234449]. Note that I am
not sure if the code is valid, but ifort 16 is able to compile it.


! code
module abstract_type_module
   implicit none
   private
   public :: abstract_type


   type, abstract :: abstract_type
      procedure (abstract_type_procedure1), pointer :: run => NULL()
   end type abstract_type

   abstract interface
      subroutine abstract_type_procedure1(this)
         import  :: abstract_type
         class(abstract_type), intent(inout) :: this
      end subroutine abstract_type_procedure1
   end interface

end module abstract_type_module


module concrete_type_module
   use abstract_type_module
   implicit none
   private
   public :: concrete_type

   type, extends(abstract_type) :: concrete_type
   contains
      procedure , pass :: init => init_concrete_type
   end type concrete_type

contains

   subroutine  run_concrete_type(this)
      implicit none
      class(abstract_type), intent(inout) :: this

        select type (this)
        type is (concrete_type)
        write(*,*) "run_concrete_type"
        class default
        write(*,*) "?"
        end select
   end subroutine run_concrete_type

   subroutine  init_concrete_type(this)
      implicit none
      class(concrete_type), intent(inout) :: this
      this % run => run_concrete_type
      write(*,*) "init_concrete_type"

   end subroutine init_concrete_type

end module concrete_type_module


program    test
   use concrete_type_module
   implicit none
    type(concrete_type) :: concrete

   call concrete % init()
   call concrete % run()

end program test

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