Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray/send_char_array_1.f90

raw
1 !{ dg-do run }
2
3 program send_convert_char_array
4
5 implicit none
6
7 character(kind=1, len=:), allocatable, codimension[:] :: co_str_k1_scal
8 character(kind=1, len=:), allocatable :: str_k1_scal
9 character(kind=4, len=:), allocatable, codimension[:] :: co_str_k4_scal
10 character(kind=4, len=:), allocatable :: str_k4_scal
11
12 character(kind=1, len=:), allocatable, codimension[:] :: co_str_k1_arr(:)
13 character(kind=1, len=:), allocatable :: str_k1_arr(:)
14 character(kind=4, len=:), allocatable, codimension[:] :: co_str_k4_arr(:)
15 character(kind=4, len=:), allocatable :: str_k4_arr(:)
16
17 allocate(str_k1_scal, SOURCE='abcdefghij')
18 allocate(str_k4_scal, SOURCE=4_'abcdefghij')
19 allocate(character(len=20)::co_str_k1_scal[*]) ! allocate syncs here
20 allocate(character(kind=4, len=20)::co_str_k4_scal[*]) ! allocate syncs here
21
22 allocate(str_k1_arr, SOURCE=['abc', 'EFG', 'klm', 'NOP'])
23 allocate(str_k4_arr, SOURCE=[4_'abc', 4_'EFG', 4_'klm', 4_'NOP'])
24 allocate(character(len=5)::co_str_k1_arr(4)[*])
25 allocate(character(kind=4, len=5)::co_str_k4_arr(4)[*])
26
27 ! First check send/copy to self
28 co_str_k1_scal[this_image()] = str_k1_scal
29 if (co_str_k1_scal /= str_k1_scal // ' ') STOP 1
30
31 co_str_k4_scal[this_image()] = str_k4_scal
32 if (co_str_k4_scal /= str_k4_scal // 4_' ') STOP 2
33
34 co_str_k4_scal[this_image()] = str_k1_scal
35 if (co_str_k4_scal /= str_k4_scal // 4_' ') STOP 3
36
37 co_str_k1_scal[this_image()] = str_k4_scal
38 if (co_str_k1_scal /= str_k1_scal // ' ') STOP 4
39
40 co_str_k1_arr(:)[this_image()] = str_k1_arr
41 if (any(co_str_k1_arr /= ['abc ', 'EFG ', 'klm ', 'NOP '])) STOP 5
42
43 co_str_k4_arr(:)[this_image()] = str_k4_arr
44 if (any(co_str_k4_arr /= [4_'abc ', 4_'EFG ', 4_'klm ', 4_'NOP '])) STOP 6
45
46 co_str_k4_arr(:)[this_image()] = str_k1_arr
47 if (any(co_str_k4_arr /= [ 4_'abc ', 4_'EFG ', 4_'klm ', 4_'NOP '])) STOP 7
48
49 co_str_k1_arr(:)[this_image()] = str_k4_arr
50 if (any(co_str_k1_arr /= ['abc ', 'EFG ', 'klm ', 'NOP '])) STOP 8
51
52 co_str_k1_arr(:)[this_image()] = ['abc', 'EFG', 'klm', 'NOP']
53 if (any(co_str_k1_arr /= ['abc ', 'EFG ', 'klm ', 'NOP '])) STOP 9
54
55 co_str_k4_arr(:)[this_image()] = [4_'abc', 4_'EFG', 4_'klm', 4_'NOP']
56 if (any(co_str_k4_arr /= [4_'abc ', 4_'EFG ', 4_'klm ', 4_'NOP '])) STOP 10
57
58 end program send_convert_char_array
59