diff gcc/testsuite/gfortran.dg/associate_24.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gfortran.dg/associate_24.f90	Fri Oct 27 22:46:09 2017 +0900
@@ -0,0 +1,33 @@
+! { dg-do run }
+!
+! From posting by Spectrum to clf on thread entitled "Bounds for array pointer dummy argument".
+!
+PROGRAM X
+    implicit none
+    TYPE T
+        INTEGER :: I
+    END TYPE T
+    TYPE(T), TARGET :: T1( 0:3 )
+
+    associate( P => T1 % I )
+        call check (lbound (P, 1), ubound (P, 1) ,1 , 4)
+    endassociate
+
+    associate( P2 => T1(:) % I )
+        call check (lbound (P2, 1), ubound (P2, 1) ,1 , 4)
+    endassociate
+
+    associate( Q => T1 )
+        call check (lbound (Q, 1), ubound (Q, 1) ,0 , 3)
+    endassociate
+
+    associate( Q2 => T1(:) )
+        call check (lbound (Q2, 1), ubound (Q2, 1) ,1 , 4)
+    endassociate
+contains
+    subroutine check (lbnd, ubnd, lower, upper)
+      integer :: lbnd, ubnd, lower, upper
+      if (lbnd .ne. lower) call abort
+      if (ubnd .ne. upper) call abort
+    end subroutine
+END PROGRAM X