! { dg-do run }! PR 22607: PURE/ELEMENTAL return-by-reference functionsprogram main
implicit nonecharacter(2),dimension(2) :: a, b
a ='ok'
b =fun(a)if(.not.all(b =='ok'))STOP1contains
elemental functionfun(a)character(*),intent(in) :: a
character(len(a)) :: fun
fun = a
end function fun
end program main