PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / deferred_character_1.f90
blob0772c70537fed07ea467836db9af028e2f06ba59
1 ! { dg-do run }
3 ! Tests the fix for PR50221
5 ! Contributed by Clive Page <clivegpage@gmail.com>
6 ! and Tobias Burnus <burnus@gcc.gnu.org>
8 ! This is from comment #2 by Tobias Burnus.
10 module m
11 character(len=:), save, allocatable :: str(:)
12 character(len=2), parameter :: const(3) = ["a1", "b2", "c3"]
13 end
15 use m
16 call test()
17 if(allocated(str)) deallocate(str)
18 call foo
19 contains
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
33 ! This is the original PR from Clive Page
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
40 end