aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f9017
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f90 b/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f90
new file mode 100644
index 000000000..f2291cd83
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f90
@@ -0,0 +1,17 @@
+! Program to test handling of reduced rank array sections. This uncovered
+! bugs in simplify_shape and the scalarization of array sections.
+program test_slice
+ implicit none
+
+ real (kind = 8), dimension(2, 2, 2) :: x
+ real (kind = 8) :: min, max
+
+ x = 1.0
+ if (minval(x(1, 1:2, 1:1)) .ne. 1.0) call abort ()
+ if (maxval(x(1, 1:2, 1:1)) .ne. 1.0) call abort ()
+ if (any (shape(x(1, 1:2, 1:1)) .ne. (/2, 1/))) call abort ()
+
+ if (any (shape(x(1, 1:2, 1)) .ne. (/2/))) call abort ()
+ if (any (shape(x(1:1, 1:2, 1:1)) .ne. (/1, 2, 1/))) call abort ()
+
+end program test_slice