Debian Codegraph @

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

raw
1 ! { dg-do run }
2 !
3 ! Test that for CAF components _gfortran_caf_deregister is called
4 ! Test that norealloc happens for CAF components during assignment
5 !
6 module m
7 type t
8 integer, allocatable :: CAF[:]
9 end type t
10 end module m
11
12 program main
13 use m
14 type(t), target :: x,y
15 integer, pointer :: ptr
16 allocate(x%caf[*], y%caf[*])
17 ptr => y%caf
18 ptr = 6
19 if (.not.allocated(x%caf)) STOP 1
20 if (.not.allocated(y%caf)) STOP 2
21 if (y%caf /= 6) STOP 3
22 x = y
23 if (x%caf /= 6) STOP 4
24 if (.not. associated (ptr,y%caf)) STOP 5
25 if (associated (ptr,x%caf)) STOP 6
26 ptr = 123
27 if (y%caf /= 123) STOP 7
28 if (x%caf /= 6) STOP 8
29 end program main