https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114020
Bug ID: 114020
Summary: ENTRY and procedure pointer leads to ICE
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: kargl at gcc dot gnu.org
Target Milestone: ---
Found with the Fujitsu testsuite. Reduced testcase.
Note, if the use of ENTRY is replace with an actual
function, ie., 'function kmr_fixfun() result(zz)" the
code compiles and executes correctly.
!
! https://github.com/fujitsu/compiler-test-suite
! Reduced from Fortran/0071/0071_0018.f90
!
module xxxf
contains
subroutine sub
end subroutine
function kmr_fixfun2() result(zz)
entry kmr_fixfun() result(zz)
procedure(sub), pointer :: zz
zz => null()
end function
integer function foo() result(zz)
procedure(sub), pointer :: fp
fp => kmr_fixfun()
zz = 0
end function foo
end module xxxf
use xxxf
if (foo() /= 0) stop
end
% gfcx -o z 0071/0071_0018.f90
0071/0071_0018.f90:8:3:
8 | function kmr_fixfun2() result(zz)
| ^
internal compiler error: in fold_convert_loc, at fold-const.cc:2633
0x741511 fold_convert_loc(unsigned int, tree_node*, tree_node*)
../../gccx/gcc/fold-const.cc:2633
0xd650c9 gimplify_modify_expr
../../gccx/gcc/gimplify.cc:6356
0xd4e52c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)