Debian Codegraph @

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

raw
1 !{ dg-do run }
2
3 ! Check that complex numbers in coarrays can get assigned to.
4 ! Contributed by Harald Anlauf <[email protected]>
5
6 program pr108233
7 implicit none
8 complex :: c = (3.0,4.0), z[*] = (6.0, 7.0)
9 complex, allocatable :: y[:]
10 allocate (y[*])
11 y = c ! allocatable complex scalar coarray is OK
12 if (c /= y) error stop 1
13 z = c ! non-allocatable complex scalar coarray was bad
14 if (c /= z) error stop 2
15 call bcast_scalar (z, c) ! failed too
16 if (c /= z) error stop 3
17 call assign_scalar (z, c) ! this works
18 if (c /= z) error stop 4
19 contains
20 subroutine assign_scalar (out, in)
21 complex, intent(out) :: out
22 complex, intent(in) :: in
23 out = in
24 end subroutine assign_scalar
25 subroutine bcast_scalar (out, in)
26 complex, intent(out) :: out[*]
27 complex, intent(in) :: in
28 out = in
29 end subroutine bcast_scalar
30 end
31