2015-01-24 Tobias Burnus <burnus@net-b.de>
PR fortran/63861
gcc/fortran/
* trans-openmp.c (gfc_has_alloc_comps): Fix handling for
scalar coarrays.
gcc/testsuite/
* gfortran.dg/goacc/coarray_2.f90: New.
@@ -189,7 +189,8 @@ gfc_has_alloc_comps (tree type, tree decl)
return false;
}
- while (GFC_DESCRIPTOR_TYPE_P (type) || GFC_ARRAY_TYPE_P (type))
+ if (GFC_DESCRIPTOR_TYPE_P (type)
+ || (GFC_ARRAY_TYPE_P (type) && GFC_TYPE_ARRAY_RANK (type) == 0))
type = gfc_get_element_type (type);
if (TREE_CODE (type) != RECORD_TYPE)
new file mode 100644
@@ -0,0 +1,112 @@
+! { dg-do compile }
+! { dg-additional-options "-fcoarray=lib" }
+!
+! PR fortran/63861
+
+module test
+contains
+ subroutine oacc1(a)
+ implicit none
+ integer :: i
+ integer, codimension[*] :: a
+ !$acc declare device_resident (a)
+ !$acc data copy (a)
+ !$acc end data
+ !$acc data deviceptr (a)
+ !$acc end data
+ !$acc parallel private (a)
+ !$acc end parallel
+ !$acc host_data use_device (a)
+ !$acc end host_data
+ !$acc parallel loop reduction(+:a)
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc parallel loop
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc update device (a)
+ !$acc update host (a)
+ !$acc update self (a)
+ end subroutine oacc1
+
+ subroutine oacc2(a)
+ implicit none
+ integer :: i
+ integer, allocatable, codimension[*] :: a
+ !$acc declare device_resident (a)
+ !$acc data copy (a)
+ !$acc end data
+ !$acc data deviceptr (a)
+ !$acc end data
+ !$acc parallel private (a)
+ !$acc end parallel
+ !$acc host_data use_device (a)
+ !$acc end host_data
+ !$acc parallel loop reduction(+:a)
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc parallel loop
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc update device (a)
+ !$acc update host (a)
+ !$acc update self (a)
+ end subroutine oacc2
+
+ subroutine oacc3(a)
+ implicit none
+ integer :: i
+ integer, codimension[*] :: a(:)
+ !$acc declare device_resident (a)
+ !$acc data copy (a)
+ !$acc end data
+ !$acc data deviceptr (a)
+ !$acc end data
+ !$acc parallel private (a)
+ !$acc end parallel
+ !$acc host_data use_device (a)
+ !$acc end host_data
+ !$acc parallel loop reduction(+:a)
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc parallel loop
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc update device (a)
+ !$acc update host (a)
+ !$acc update self (a)
+ end subroutine oacc2
+
+ subroutine oacc2(a)
+ implicit none
+ integer :: i
+ integer, allocatable, codimension[*] :: a(:)
+ !$acc declare device_resident (a)
+ !$acc data copy (a)
+ !$acc end data
+ !$acc data deviceptr (a)
+ !$acc end data
+ !$acc parallel private (a)
+ !$acc end parallel
+ !$acc host_data use_device (a)
+ !$acc end host_data
+ !$acc parallel loop reduction(+:a)
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc parallel loop
+ do i = 1,5
+ enddo
+ !$acc end parallel loop
+ !$acc update device (a)
+ !$acc update host (a)
+ !$acc update self (a)
+ end subroutine oacc2
+end module test
+! { dg-excess-errors "sorry, unimplemented: directive not yet implemented" }