https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93924
Bug ID: 93924
Summary: ICE in gfc_class_len_get at trans_expr.c:231 with
function returning a procedure pointer
Product: gcc
Version: 9.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mscfd at gmx dot net
Target Milestone: ---
The code below aborts with an ICE. This happens with 9.1.1 as well as a recent
gfortran-10 compiled version. The ICE is due to the function selector.
module cs
implicit none
private
public classStar_map_ifc
public apply, selector
abstract interface
function classStar_map_ifc(x) result(y)
class(*), pointer :: y
class(*), target, intent(in) :: x
end function classStar_map_ifc
end interface
contains
function fun(x) result(y)
class(*), pointer :: y
class(*), target, intent(in) :: x
select type (x)
type is (integer)
y => x
class default
y => null()
end select
end function fun
function apply(f, x) result(y)
procedure(classStar_map_ifc) :: f
integer, intent(in) :: x
integer :: y
class(*), pointer :: p
p => f(x)
select type (p)
type is (integer)
y = p
end select
end function apply
function selector() result(f)
procedure(classStar_map_ifc), pointer :: f
f => fun
end function selector
end module cs
program classStar_map
use cs
implicit none
integer :: x, y
procedure(classStar_map_ifc), pointer :: f
x = 123654
f => selector()
y = apply(f, x)
print *, x, y
end program classStar_map