https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113621
--- Comment #2 from anlauf at gcc dot gnu.org ---
I guess the following reduced testcase shows the same crash:
program test
implicit none
character(4) :: c(7) = "*"
call three_val (c)
contains
subroutine three_val (i, j)
character(4), intent(in) :: i(7)
character(4), value, optional :: j
if (present (j)) stop 7
call four (i, j)
call four_val (i, j)
end
elemental subroutine four (i, j)
character(4), intent(in) :: i
character(4), intent(in), optional :: j
if (present (j)) error stop 13
end
elemental subroutine four_val (i, j)
character(4), intent(in) :: i
character(4), value, optional :: j
if (present (j)) error stop 14
end
end