3 ! Tests the fix for PR67674
5 ! Contributed by Kristopher Kuhlman <kristopher.kuhlman@gmail.com>
11 character(len
=:), allocatable
:: name
13 type(string_type
), allocatable
:: my_string_type
15 allocate(my_string_type
)
16 allocate(character(len
=0) :: my_string_type
%name
)
18 ! print *, 'length main program before',len(my_string_type%name)
20 call inputreadword1(my_string_type
%name
)
22 ! print *, 'length main program after',len(my_string_type%name)
23 ! print *, 'final result:',my_string_type%name
24 if (my_string_type
%name
.ne
. 'here the word is finally set') STOP 1
27 subroutine inputreadword1(word_intermediate
)
28 character(len
=:), allocatable
:: word_intermediate
30 ! print *, 'length intermediate before',len(word_intermediate)
31 call inputreadword2(word_intermediate
)
32 ! print *, 'length intermediate after',len(word_intermediate)
33 ! print *, word_intermediate
35 end subroutine inputreadword1
37 subroutine inputreadword2(word
)
38 character(len
=:), allocatable
:: word
40 ! print *, 'length inner before',len(word)
41 word
= 'here the word is finally set' ! want automatic reallocation to happen here
42 ! print *, 'length inner after',len(word)
45 end subroutine inputreadword2