]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
resolve.c (resolve_function): Don't do assumed-size check for lcobound/ucobound.
authorTobias Burnus <burnus@net-b.de>
Wed, 30 Apr 2014 19:08:19 +0000 (21:08 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 30 Apr 2014 19:08:19 +0000 (21:08 +0200)
2014-04-30  Tobias Burnus  <burnus@net-b.de>

        * 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  <burnus@net-b.de>

        * 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
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/coarray/codimension.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90
gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90

index 3502f489f22eaa0dafa142cc1b28bd6e65b80e75..1dcde5db695c3ccf06aadc135ac0bcf0c7e7276c 100644 (file)
@@ -1,3 +1,10 @@
+2014-04-30  Tobias Burnus  <burnus@net-b.de>
+
+       * 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  <burnus@net-b.de>
 
        * gfortran.h (gfc_init_coarray_decl): Remove.
index 38755fef6a27ee1db5fec00f8c4f20e6794dbaf6..15c94635f49acb0d6eb186ae73fa53062d7c6f88 100644 (file)
@@ -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
index 74791d9155b1bd8f6d81862c8a46af7de30556e7..862f133d8789ad0556ec5e1aa5e720208c1ccc17 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-30  Tobias Burnus  <burnus@net-b.de>
+
+       * 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  <burnus@net-b.de>
 
        * 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 (file)
index 0000000..706048f
--- /dev/null
@@ -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
index 9219b2a6571ad3fb641dd27f087393d783562ec2..afa1a7ea4d7fcaee0d88467df426d26563b325dd 100644 (file)
@@ -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" } }
index 43da9f4c909096d25d9edf6adc33952d27decc09..9e445f4a0dea05182a34cc5451af425bb5006e7b 100644 (file)
@@ -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" } }
 !