summaryrefslogtreecommitdiff
path: root/flang/test/Semantics/contiguous02.f90
diff options
context:
space:
mode:
Diffstat (limited to 'flang/test/Semantics/contiguous02.f90')
-rw-r--r--flang/test/Semantics/contiguous02.f9027
1 files changed, 27 insertions, 0 deletions
diff --git a/flang/test/Semantics/contiguous02.f90 b/flang/test/Semantics/contiguous02.f90
new file mode 100644
index 000000000000..6543ea92b940
--- /dev/null
+++ b/flang/test/Semantics/contiguous02.f90
@@ -0,0 +1,27 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
+subroutine s1
+ type :: d1
+ real :: x
+ end type
+ type :: d2
+ type(d1) :: x
+ end type
+ type(d1), target :: a(5)
+ type(d2), target :: b(5)
+ real, pointer, contiguous :: c(:)
+ c => a%x ! okay, type has single component
+ c => b%x%x ! okay, types have single components
+end
+
+subroutine s2
+ type :: d1
+ real :: x, y
+ end type
+ type(d1), target :: b(5)
+ real, pointer, contiguous :: c(:)
+ !ERROR: CONTIGUOUS pointer may not be associated with a discontiguous target
+ c => b%x
+ c => b(1:1)%x ! okay, one element
+ !ERROR: CONTIGUOUS pointer may not be associated with a discontiguous target
+ c => b(1:2)%x
+end