annotate gcc/testsuite/gfortran.dg/char_length_7.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
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 ! Test the fix for PR31879 in which the concatenation operators below
kono
parents:
diff changeset
3 ! would cause ICEs because the character lengths were never resolved.
kono
parents:
diff changeset
4 !
kono
parents:
diff changeset
5 ! Contributed by Vivek Rao <vivekrao4@yahoo.com>
kono
parents:
diff changeset
6 !
kono
parents:
diff changeset
7 module str_mod
kono
parents:
diff changeset
8 character(3) :: mz(2) = (/"fgh","ijk"/)
kono
parents:
diff changeset
9 contains
kono
parents:
diff changeset
10 function ccopy(yy) result(xy)
kono
parents:
diff changeset
11 character (len=*), intent(in) :: yy(:)
kono
parents:
diff changeset
12 character (len=5) :: xy(size(yy))
kono
parents:
diff changeset
13 xy = yy
kono
parents:
diff changeset
14 end function ccopy
kono
parents:
diff changeset
15 end module str_mod
kono
parents:
diff changeset
16 !
kono
parents:
diff changeset
17 program xx
kono
parents:
diff changeset
18 use str_mod, only: ccopy, mz
kono
parents:
diff changeset
19 implicit none
kono
parents:
diff changeset
20 character(2) :: z = "zz"
kono
parents:
diff changeset
21 character(3) :: zz(2) = (/"abc","cde"/)
kono
parents:
diff changeset
22 character(2) :: ans(2)
kono
parents:
diff changeset
23 integer :: i = 2, j = 3
kono
parents:
diff changeset
24 if (any(ccopy("_&_"//(/"A","B"/)//"?") .ne. (/"_&_A?","_&_B?"/))) call abort ()
kono
parents:
diff changeset
25 if (any(ccopy(z//zz) .ne. (/"zzabc","zzcde"/))) call abort ()
kono
parents:
diff changeset
26 if (any(ccopy(z//zz(:)(1:2)) .ne. (/"zzab ","zzcd "/))) call abort ()
kono
parents:
diff changeset
27 if (any(ccopy(z//mz(:)(2:3)) .ne. (/"zzgh ","zzjk "/))) call abort ()
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 ! This was another bug, uncovered when the PR was fixed.
kono
parents:
diff changeset
30 if (any(ccopy(z//mz(:)(i:j)) .ne. (/"zzgh ","zzjk "/))) call abort ()
kono
parents:
diff changeset
31 end program xx