From 2c060879af5a92b49c11e70004fcd377f6a5a3ea Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 30 Apr 2014 21:08:19 +0200 Subject: [PATCH] resolve.c (resolve_function): Don't do assumed-size check for lcobound/ucobound. 2014-04-30 Tobias Burnus * resolve.c (resolve_function): Don't do assumed-size check for lcobound/ucobound. * trans-types.c (gfc_build_array_type): Only build an array descriptor with codimensions for allocatable coarrays. 2014-04-30 Tobias Burnus * gfortran.dg/coarray_lib_this_image_2.f90: Update dump. * gfortran.dg/coarray_lib_token_4.f90: Ditto. * gfortran.dg/coarray/codimension.f90: New. From-SVN: r209952 --- gcc/fortran/ChangeLog | 7 +++ gcc/fortran/resolve.c | 2 + gcc/testsuite/ChangeLog | 6 +++ .../gfortran.dg/coarray/codimension.f90 | 49 +++++++++++++++++++ .../gfortran.dg/coarray_lib_this_image_2.f90 | 2 +- .../gfortran.dg/coarray_lib_token_4.f90 | 4 +- 6 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/coarray/codimension.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3502f489f22e..1dcde5db695c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2014-04-30 Tobias Burnus + + * resolve.c (resolve_function): Don't do + assumed-size check for lcobound/ucobound. + * trans-types.c (gfc_build_array_type): Only build an array + descriptor with codimensions for allocatable coarrays. + 2014-04-30 Tobias Burnus * gfortran.h (gfc_init_coarray_decl): Remove. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 38755fef6a27..15c94635f49a 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2942,6 +2942,8 @@ resolve_function (gfc_expr *expr) else if (expr->value.function.actual != NULL && expr->value.function.isym != NULL && GENERIC_ID != GFC_ISYM_LBOUND + && GENERIC_ID != GFC_ISYM_LCOBOUND + && GENERIC_ID != GFC_ISYM_UCOBOUND && GENERIC_ID != GFC_ISYM_LEN && GENERIC_ID != GFC_ISYM_LOC && GENERIC_ID != GFC_ISYM_C_LOC diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74791d9155b1..862f133d8789 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-04-30 Tobias Burnus + + * gfortran.dg/coarray_lib_this_image_2.f90: Update dump. + * gfortran.dg/coarray_lib_token_4.f90: Ditto. + * gfortran.dg/coarray/codimension.f90: New. + 2014-04-30 Tobias Burnus * gfortran.dg/coarray_lib_this_image_1.f90: New. diff --git a/gcc/testsuite/gfortran.dg/coarray/codimension.f90 b/gcc/testsuite/gfortran.dg/coarray/codimension.f90 new file mode 100644 index 000000000000..706048f33efd --- /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 diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 index 9219b2a6571a..afa1a7ea4d7f 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 @@ -16,7 +16,7 @@ contains end subroutine bar end -! { dg-final { scan-tree-dump-times "bar \\(struct array2_real\\(kind=4\\) & restrict x, void \\* restrict caf_token.., integer\\(kind=8\\) caf_offset..\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "bar \\(struct array1_real\\(kind=4\\) & restrict x, void \\* restrict caf_token.., integer\\(kind=8\\) caf_offset..\\)" 1 "original" } } ! { dg-final { scan-tree-dump-times "mylcobound = 5;" 1 "original" } } ! { dg-final { scan-tree-dump-times "parm...dim\\\[1\\\].lbound = 5;" 1 "original" } } ! { dg-final { scan-tree-dump-times "myucobound = \\(integer\\(kind=4\\)\\) \\(\\(\\(unsigned int\\) parm...dim\\\[1\\\].lbound \\+ \\(unsigned int\\) _gfortran_caf_num_images \\(0, -1\\)\\) \\+ 4294967295\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90 index 43da9f4c9090..9e445f4a0dea 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90 @@ -35,9 +35,9 @@ end program test_caf ! { dg-final { scan-tree-dump-times "expl \\(integer\\(kind=4\\).0:. . restrict z, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } } ! -! { dg-final { scan-tree-dump-times "bar \\(struct array2_integer\\(kind=4\\) & restrict y, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "bar \\(struct array1_integer\\(kind=4\\) & restrict y, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } } ! -! { dg-final { scan-tree-dump-times "foo \\(struct array2_integer\\(kind=4\\) & restrict x, struct array2_integer\\(kind=4\\) & restrict y, integer\\(kind=4\\) & restrict test, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "foo \\(struct array1_integer\\(kind=4\\) & restrict x, struct array1_integer\\(kind=4\\) & restrict y, integer\\(kind=4\\) & restrict test, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } } ! ! { dg-final { scan-tree-dump-times "bar \\(&parm.\[0-9\]+, caf_token.\[0-9\]+, \\(\\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) x.\[0-9\]+\\) \\+ caf_offset.\[0-9\]+\\);" 1 "original" } } ! -- 2.47.3