summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/shape_2.f90
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-13 08:07:15 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-13 08:07:15 +0000
commitec9200dc186d96741a2e2f9fee6a8f291ce1e647 (patch)
tree4ffb56101370a9ad4a80a7d08f8ff17f9bffa6b7 /gcc/testsuite/gfortran.dg/shape_2.f90
parent4f62605b84a6f6be88c854271a718cd721377c2b (diff)
downloadgcc-ec9200dc186d96741a2e2f9fee6a8f291ce1e647.tar.gz
PR fortran/18899
* trans-intrinsic.c (gfc_conv_intrinsic_bound): Move initialization of argse. Remove now-redundant want_pointer assignment. * trans-array.c (gfc_conv_expr_descriptor): When not assigning to a pointer, keep the original bounds of a full array reference. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104219 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/shape_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/shape_2.f9030
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/shape_2.f90 b/gcc/testsuite/gfortran.dg/shape_2.f90
new file mode 100644
index 00000000000..a4bde98ba5f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/shape_2.f90
@@ -0,0 +1,30 @@
+! Check that lbound() and ubound() work correctly for assumed shapes.
+! { dg-do run }
+program main
+ integer, dimension (40, 80) :: a = 1
+ call test (a)
+contains
+ subroutine test (b)
+ integer, dimension (11:, -8:), target :: b
+ integer, dimension (:, :), pointer :: ptr
+
+ if (lbound (b, 1) .ne. 11) call abort
+ if (ubound (b, 1) .ne. 50) call abort
+ if (lbound (b, 2) .ne. -8) call abort
+ if (ubound (b, 2) .ne. 71) call abort
+
+ if (lbound (b (:, :), 1) .ne. 1) call abort
+ if (ubound (b (:, :), 1) .ne. 40) call abort
+ if (lbound (b (:, :), 2) .ne. 1) call abort
+ if (ubound (b (:, :), 2) .ne. 80) call abort
+
+ if (lbound (b (20:30:3, 40), 1) .ne. 1) call abort
+ if (ubound (b (20:30:3, 40), 1) .ne. 4) call abort
+
+ ptr => b
+ if (lbound (ptr, 1) .ne. 1) call abort
+ if (ubound (ptr, 1) .ne. 40) call abort
+ if (lbound (ptr, 2) .ne. 1) call abort
+ if (ubound (ptr, 2) .ne. 80) call abort
+ end subroutine test
+end program main