]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Sun, 5 Jun 2005 19:01:57 +0000 (19:01 +0000)
committerNo Author <no-author@gcc.gnu.org>
Sun, 5 Jun 2005 19:01:57 +0000 (19:01 +0000)
'gcc-4_0-branch'.

From-SVN: r100634

gcc/testsuite/gfortran.dg/array_constructor_4.f90 [new file with mode: 0644]

diff --git a/gcc/testsuite/gfortran.dg/array_constructor_4.f90 b/gcc/testsuite/gfortran.dg/array_constructor_4.f90
new file mode 100644 (file)
index 0000000..cae6515
--- /dev/null
@@ -0,0 +1,23 @@
+! { dg-do run }
+! PR 21912
+! We didn't adapt the exit condition to negative steps in array constructors,
+! leaving the resulting arrays uninitialized.
+integer :: i(5), n, m, l, k
+
+n = 5
+i = (/ (m, m = n, 1, -1) /)
+if (any (i /= (/ 5, 4, 3, 2, 1 /))) call abort
+
+k = 1
+
+i(5:1:-1) = (/ (m, m = n, k, -1) /)
+if (any (i /= (/ 1, 2, 3, 4, 5 /))) call abort
+
+l = -1
+
+i = (/ (m, m = n, 1, l) /)
+if (any (i /= (/ 5, 4, 3, 2, 1 /))) call abort
+
+i(5:1:-1) = (/ (m, m = n, k, l) /)
+if (any (i /= (/ 1, 2, 3, 4, 5 /))) call abort
+end