1! { dg-do run } 2! 3! Tests the fix for PR50221 4! 5! Contributed by Clive Page <clivegpage@gmail.com> 6! and Tobias Burnus <burnus@gcc.gnu.org> 7! 8! This is from comment #2 by Tobias Burnus. 9! 10module m 11 character(len=:), save, allocatable :: str(:) 12 character(len=2), parameter :: const(3) = ["a1", "b2", "c3"] 13end 14 15 use m 16 call test() 17 if(allocated(str)) deallocate(str) 18 call foo 19contains 20 subroutine test() 21 call doit() 22! print *, 'strlen=',len(str),' / array size =',size(str) 23! print '(3a)', '>',str(1),'<' 24! print '(3a)', '>',str(2),'<' 25! print '(3a)', '>',str(3),'<' 26 if (any (str .ne. const)) call abort 27 end subroutine test 28 subroutine doit() 29 str = const 30 end subroutine doit 31 subroutine foo 32! 33! This is the original PR from Clive Page 34! 35 character(:), allocatable, dimension(:) :: array 36 array = (/'xx', 'yy', 'zz'/) 37! print *, 'array=', array, len(array(1)), size(array) 38 if (any (array .ne. ["xx", "yy", "zz"])) call abort 39 end subroutine 40end 41