1! { dg-do run } 2! 3! PR fortran/43199 4! 5! This program gave an ICE due to reading the REF_COMPONENT with CLASS. 6! 7module m_string 8 type t_string 9 character, dimension(:), allocatable :: string 10 end type t_string 11contains 12pure function string_to_char ( s ) result(res) 13 class(t_string), intent(in) :: s 14 character(len=size(s%string)) :: res 15 integer :: i 16 do i = 1,len(res) 17 res(i:i) = s%string(i) 18 end do 19end function string_to_char 20end module m_string 21 22use m_string 23type(t_string) :: str 24allocate(str%string(5)) 25str%string = ['H','e','l','l','o'] 26if (len (string_to_char (str)) /= 5) STOP 1 27if (string_to_char (str) /= "Hello") STOP 2 28end 29