summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.fortran-torture/execute/ptr.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.fortran-torture/execute/ptr.f90')
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/ptr.f9020
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/ptr.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/ptr.f90
new file mode 100644
index 00000000000..2675f0866c2
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/ptr.f90
@@ -0,0 +1,20 @@
+program ptr
+ implicit none
+ integer, pointer, dimension(:) :: a, b
+ integer, pointer :: p
+ integer, target :: i
+
+ allocate (a(1:6))
+
+ a = (/ 1, 2, 3, 4, 5, 6 /)
+ b => a
+ if (any (b .ne. (/ 1, 2, 3, 4, 5, 6 /))) call abort
+ b => a(1:6:2)
+ if (any (b .ne. (/ 1, 3, 5/))) call abort
+
+ p => i
+ i = 42
+ if (p .ne. 42) call abort
+ p => a(4)
+ if (p .ne. 4) call abort
+end program