diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/coarray/codimension.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/coarray/codimension.f90 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/coarray/codimension.f90 b/gcc/testsuite/gfortran.dg/coarray/codimension.f90 new file mode 100644 index 00000000000..706048f33ef --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/codimension.f90 @@ -0,0 +1,49 @@ +! { dg-do run } +! +! Based on coarray_lib_token_4.f90 but checking whether the bounds +! are correctly handled. +! +program test_caf + implicit none + integer, allocatable :: A(:)[:] + integer, save :: B(3)[*] + integer :: i + + allocate (A(3)[*]) + A = [1, 2, 3 ] + B = [9, 7, 4 ] + call foo (A, A, test=1) + call foo (A(2:3), B, test=2) + call foo (B, A, test=3) +contains + subroutine foo(x, y, test) + integer :: x(:)[*] + integer, contiguous :: y(:)[*] + integer :: test + integer :: i, j + call bar (x) + call expl (y) + i = lcobound(x, dim=1) + j = ucobound(x, dim=1) + if (i /= 1 .or. j /= num_images()) call abort() + i = lcobound(y, dim=1) + j = ucobound(y, dim=1) + if (i /= 1 .or. j /= num_images()) call abort() + end subroutine foo + + subroutine bar(y) + integer :: y(:)[*] + integer :: i, j + i = lcobound(y, dim=1) + j = ucobound(y, dim=1) + if (i /= 1 .or. j /= num_images()) call abort() + end subroutine bar + + subroutine expl(z) + integer :: z(*)[*] + integer :: i, j + i = lcobound(z, dim=1) + j = ucobound(z, dim=1) + if (i /= 1 .or. j /= num_images()) call abort() + end subroutine expl +end program test_caf |