2016-09-20 Andre Vehreschild <vehre@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / coarray_allocate_7.f08
blob918f3e237f8281f13298ae30f4467473be35dcd7
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" }
4 ! Contributed by Damian Rouson
5 ! Checking whether (de-)registering of coarrays works.
7 program main
9   implicit none
11   type mytype
12     integer, allocatable :: indices(:)
13   end type
15   type(mytype), save :: object[*]
16   integer :: i,me
18   me=this_image() ! me is always 1 here
19   object%indices=[(i,i=1,me)]
20   if ( size(object%indices) /= 1 ) call abort()
21   ! therefore no array is present here and no array test needed.
22   if ( object%indices(1) /= 1 ) call abort()
23 end program
25 ! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(D.\[0-9\]+, 1, &\\(\\(struct mytype\\) \\*object\\).indices.token, &\\(\\(struct mytype\\) \\*object\\).indices, 0B, 0B, 0\\);" 2 "original" } }
26 ! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct mytype\\) \\*object\\).indices.token, 0B, 0B, 0\\);" 1 "original" } }