On Sep 19 2016, Andre Vehreschild <ve...@gmx.de> wrote:

> Index: gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
> ===================================================================
> --- gcc/testsuite/gfortran.dg/coarray_allocate_7.f08  (nicht existent)
> +++ gcc/testsuite/gfortran.dg/coarray_allocate_7.f08  (Arbeitskopie)
> @@ -0,0 +1,27 @@
> +! { dg-do run }
> +! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" }
> +
> +! Contributed by Damian Rouson
> +! Checking whether (de-)registering of coarrays works.
> +
> +program main
> +
> +  implicit none
> +
> +  type mytype
> +    integer, allocatable :: indices(:)
> +  end type
> +
> +  type(mytype), save :: object[*]
> +  integer :: i,me
> +
> +  me=this_image() ! me is always 1 here
> +  object%indices=[(i,i=1,me)]
> +  if ( size(object%indices) /= 1 ) call abort()
> +  ! therefore no array is present here and no array test needed.
> +  if ( object%indices(1) /= 1 ) call abort()
> +end program
> +
> +! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(D.\[0-9\]{4}, 
> 1, &\\(\\(struct mytype\\) \\*object\\).indices.token, &\\(\\(struct 
> mytype\\) \\*object\\).indices, 0B, 0B, 0\\);" 2 "original" } }
> +! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
> \\(&\\(\\(struct mytype\\) \\*object\\).indices.token, 0B, 0B, 0\\);" 1 
> "original" } }
> +

FAIL: gfortran.dg/coarray_allocate_7.f08   -O0   scan-tree-dump-times original 
"_gfortran_caf_register \\(D.[0-9]{4}, 1, &\\(\\(struct mytype\\) 
\\*object\\).indices.token, &\\(\\(struct mytype\\) \\*object\\).indices, 0B, 
0B, 0\\);" 2
PASS: gfortran.dg/coarray_allocate_7.f08   -O0   scan-tree-dump-times original 
"_gfortran_caf_deregister \\(&\\(\\(struct mytype\\) 
\\*object\\).indices.token, 0B, 0B, 0\\);" 1

$ grep _gfortran_caf_register coarray_allocate_7.f08.003t.original 
  _gfortran_caf_register (28, 0, (void * *) &caf_token.0, (void *) &desc.2, 0B, 
0B, 0);
            _gfortran_caf_register (D.986, 1, &((struct mytype) 
*object).indices.token, &((struct mytype) *object).indices, 0B, 0B, 0);
                _gfortran_caf_register (D.986, 1, &((struct mytype) 
*object).indices.token, &((struct mytype) *object).indices, 0B, 0B, 0);

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Reply via email to