aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-05-27 23:29:19 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-05-27 23:29:19 +0200
commit5aacb11e06658a9d38b9810db0d9587c64271122 (patch)
tree22ef55bff748e9924fba15d6b5baabb76acb616d /gcc/testsuite/gfortran.dg
parentfc64b4481d6085c4f4fd260b5801d0785c8a7a02 (diff)
downloadgcc-5aacb11e06658a9d38b9810db0d9587c64271122.zip
gcc-5aacb11e06658a9d38b9810db0d9587c64271122.tar.gz
gcc-5aacb11e06658a9d38b9810db0d9587c64271122.tar.bz2
re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * check.c (gfc_check_associated, gfc_check_null): Add coindexed * check. * match.c (gfc_match_nullify): Ditto. * resolve.c (resolve_deallocate_expr): Ditto. * trans-types.c (gfc_get_nodesc_array_type): Don't set * restricted for nonpointers. 2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * gfortran.dg/coarray_22.f90: New. From-SVN: r174364
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_22.f9033
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/coarray_22.f90 b/gcc/testsuite/gfortran.dg/coarray_22.f90
new file mode 100644
index 0000000..b09dfe3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_22.f90
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! Constraint checks for invalid access of remote pointers
+! (Accessing the value is ok, checking/changing association
+! status is invalid)
+!
+! PR fortran/18918
+!
+type t
+ integer, pointer :: ptr => null()
+end type t
+type(t) :: x[*], y[*]
+
+if (associated(x%ptr)) stop 0
+if (associated(x%ptr,y%ptr)) stop 0
+
+if (associated(x[1]%ptr)) stop 0 ! { dg-error "shall not be conindexed" }
+if (associated(x%ptr,y[1]%ptr)) stop 0 ! { dg-error "shall not be conindexed" }
+
+nullify (x%ptr)
+nullify (x[1]%ptr) ! { dg-error "shall not be conindexed" }
+
+x%ptr => null(x%ptr)
+x%ptr => null(x[1]%ptr) ! { dg-error "shall not be conindexed" }
+x[1]%ptr => null(x%ptr) ! { dg-error "shall not have a coindex" }
+
+allocate(x%ptr)
+deallocate(x%ptr)
+
+allocate(x[1]%ptr) ! { dg-error "Coindexed allocatable object" }
+deallocate(x[1]%ptr) ! { dg-error "Coindexed allocatable object" }
+end