Debian Codegraph @

gcc/testsuite/gfortran.dg/save_alloc_character_1.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/120713
4 ! Check that the length variable of SAVEd allocatable character arrays are
5 ! not initialized at function entry.
6
7 program p
8 implicit none
9 call s(1)
10 call s(2)
11 contains
12 subroutine s(i)
13 integer, intent(in) :: i
14 character(len=:), allocatable, save :: a(:)
15 integer :: j
16 if (i == 1) then
17 allocate(a, source= [ ('x' // achar(ichar('0') + j), j=1,7) ])
18 else
19 if (len(a) /= 2) error stop 1
20 if (any(a /= ['x1','x2','x3','x4','x5','x6','x7'])) error stop 2
21 end if
22 end subroutine s
23 end program p