111
|
1 ! { dg-do run }
|
|
2 !
|
|
3 ! PR fortran/47421
|
|
4 !
|
|
5 ! Don't auto-deallocatable scalar character allocatables.
|
|
6 !
|
|
7 implicit none
|
|
8 character(len=5), allocatable :: str
|
|
9 allocate(str)
|
|
10 str = '1bcde'
|
131
|
11 if(str /= '1bcde') STOP 1
|
111
|
12 call sub(str,len(str))
|
131
|
13 if(str /= '1bcde') STOP 2
|
111
|
14 call subOUT(str,len(str))
|
131
|
15 if (len(str) /= 5) STOP 3
|
|
16 if(allocated(str)) STOP 4
|
111
|
17 contains
|
|
18 subroutine sub(x,n)
|
|
19 integer :: n
|
|
20 character(len=n), allocatable :: x
|
131
|
21 if(len(x) /= 5) STOP 5
|
|
22 if(x /= '1bcde') STOP 6
|
111
|
23 end subroutine sub
|
|
24 subroutine subOUT(x,n)
|
|
25 integer :: n
|
|
26 character(len=n), allocatable,intent(out) :: x
|
131
|
27 if(allocated(x)) STOP 7
|
|
28 if(len(x) /= 5) STOP 8
|
111
|
29 end subroutine subOUT
|
|
30 end
|