annotate gcc/testsuite/gfortran.dg/allocatable_scalar_12.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 !
kono
parents:
diff changeset
3 ! PR fortran/47421
kono
parents:
diff changeset
4 !
kono
parents:
diff changeset
5 ! Don't auto-deallocatable scalar character allocatables.
kono
parents:
diff changeset
6 !
kono
parents:
diff changeset
7 implicit none
kono
parents:
diff changeset
8 character(len=5), allocatable :: str
kono
parents:
diff changeset
9 allocate(str)
kono
parents:
diff changeset
10 str = '1bcde'
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
11 if(str /= '1bcde') STOP 1
111
kono
parents:
diff changeset
12 call sub(str,len(str))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
13 if(str /= '1bcde') STOP 2
111
kono
parents:
diff changeset
14 call subOUT(str,len(str))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
15 if (len(str) /= 5) STOP 3
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
16 if(allocated(str)) STOP 4
111
kono
parents:
diff changeset
17 contains
kono
parents:
diff changeset
18 subroutine sub(x,n)
kono
parents:
diff changeset
19 integer :: n
kono
parents:
diff changeset
20 character(len=n), allocatable :: x
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
21 if(len(x) /= 5) STOP 5
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
22 if(x /= '1bcde') STOP 6
111
kono
parents:
diff changeset
23 end subroutine sub
kono
parents:
diff changeset
24 subroutine subOUT(x,n)
kono
parents:
diff changeset
25 integer :: n
kono
parents:
diff changeset
26 character(len=n), allocatable,intent(out) :: x
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
27 if(allocated(x)) STOP 7
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
28 if(len(x) /= 5) STOP 8
111
kono
parents:
diff changeset
29 end subroutine subOUT
kono
parents:
diff changeset
30 end