aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/do_subscript_5.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/do_subscript_5.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/do_subscript_5.f9020
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/do_subscript_5.f90 b/gcc/testsuite/gfortran.dg/do_subscript_5.f90
new file mode 100644
index 00000000000..54a4f1ba51a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/do_subscript_5.f90
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! { dg-additional-options "-Wdo-subscript" }
+! PR 90563 - this used to be rejected, wrongly
+! Original test case by Tobias Neumann
+program test
+ implicit none
+ integer, parameter :: swap(4) = [2,1,3,4]
+ real :: p(20)
+ integer :: j
+
+ p = 0.0
+
+ ! The following warnings are actually bogus, but we are not yet
+ ! clever enough to suppress them.
+ do j=1,6 ! { dg-warning "out of bounds" }
+ if (j<5) then
+ p(j) = p(swap(j)) ! { dg-warning "out of bounds" }
+ endif
+ enddo
+end program