2016-01-15 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / module_read_2.f90
blob565c188f88f623ff5ca2e5997105687bcddee34b
1 ! { dg-do run }
3 ! PR fortran/43199
5 ! This program gave an ICE due to reading the REF_COMPONENT with CLASS.
7 module m_string
8 type t_string
9 character, dimension(:), allocatable :: string
10 end type t_string
11 contains
12 pure 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
19 end function string_to_char
20 end module m_string
22 use m_string
23 type(t_string) :: str
24 allocate(str%string(5))
25 str%string = ['H','e','l','l','o']
26 if (len (string_to_char (str)) /= 5) call abort ()
27 if (string_to_char (str) /= "Hello") call abort ()
28 end