aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_10.f9023
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_11.f9023
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_12.f909
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_13.f9010
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_14.f9015
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_15.f9015
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/where_16.f9039
8 files changed, 144 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cb41751..78d593d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2006-02-16 Roger Sayle <roger@eyesopen.com>
+
+ * gfortran.fortran-torture/execute/where_10.f90: New test case.
+ * gfortran.fortran-torture/execute/where_11.f90: Likewise.
+ * gfortran.fortran-torture/execute/where_12.f90: Likewise.
+ * gfortran.fortran-torture/execute/where_13.f90: Likewise.
+ * gfortran.fortran-torture/execute/where_14.f90: Likewise.
+ * gfortran.fortran-torture/execute/where_15.f90: Likewise.
+ * gfortran.fortran-torture/execute/where_16.f90: Likewise.
+
2006-02-16 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/vrp24.c: Update expected output.
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_10.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_10.f90
new file mode 100644
index 0000000..c5a85ce
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_10.f90
@@ -0,0 +1,23 @@
+! Check whether conditional ELSEWHEREs work
+! (with final unconditional ELSEWHERE)
+program where_10
+ integer :: a(5)
+ integer :: b(5)
+
+ a = (/1, 2, 3, 4, 5/)
+ b = (/0, 0, 0, 0, 0/)
+ where (a .eq. 1)
+ b = 3
+ elsewhere (a .eq. 2)
+ b = 1
+ elsewhere (a .eq. 3)
+ b = 4
+ elsewhere (a .eq. 4)
+ b = 1
+ elsewhere
+ b = 5
+ endwhere
+ if (any (b .ne. (/3, 1, 4, 1, 5/))) &
+ call abort
+end program
+
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_11.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_11.f90
new file mode 100644
index 0000000..f2eb69f
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_11.f90
@@ -0,0 +1,23 @@
+! Check whether conditional ELSEWHEREs work
+! (without unconditional ELSEWHERE)
+program where_11
+ integer :: a(5)
+ integer :: b(5)
+
+ a = (/1, 2, 3, 4, 5/)
+ b = (/0, 0, 0, 0, 0/)
+ where (a .eq. 1)
+ b = 3
+ elsewhere (a .eq. 2)
+ b = 1
+ elsewhere (a .eq. 3)
+ b = 4
+ elsewhere (a .eq. 4)
+ b = 1
+ elsewhere (a .eq. 5)
+ b = 5
+ endwhere
+ if (any (b .ne. (/3, 1, 4, 1, 5/))) &
+ call abort
+end program
+
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_12.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_12.f90
new file mode 100644
index 0000000..c95dc97
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_12.f90
@@ -0,0 +1,9 @@
+! Check empty WHEREs work
+program where_12
+ integer :: a(5)
+
+ a = (/1, 2, 3, 4, 5/)
+ where (a .eq. 1)
+ endwhere
+end program
+
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_13.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_13.f90
new file mode 100644
index 0000000..ce8d582
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_13.f90
@@ -0,0 +1,10 @@
+! Check empty WHERE and empty ELSEWHERE works
+program where_13
+ integer :: a(5)
+
+ a = (/1, 2, 3, 4, 5/)
+ where (a .eq. 2)
+ elsewhere
+ endwhere
+end program
+
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_14.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_14.f90
new file mode 100644
index 0000000..640bdf5
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_14.f90
@@ -0,0 +1,15 @@
+! Check whether an empty ELSEWHERE works
+program where_14
+ integer :: a(5)
+ integer :: b(5)
+
+ a = (/1, 2, 3, 4, 5/)
+ b = (/0, 0, 0, 0, 0/)
+ where (a .eq. 1)
+ b = 3
+ elsewhere
+ endwhere
+ if (any (b .ne. (/3, 0, 0, 0, 0/))) &
+ call abort
+end program
+
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_15.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_15.f90
new file mode 100644
index 0000000..ffbebb7
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_15.f90
@@ -0,0 +1,15 @@
+! Check whether an empty WHERE works
+program where_15
+ integer :: a(5)
+ integer :: b(5)
+
+ a = (/1, 2, 3, 4, 5/)
+ b = (/0, 0, 0, 0, 0/)
+ where (a .eq. 1)
+ elsewhere
+ b = 2
+ endwhere
+ if (any (b .ne. (/0, 2, 2, 2, 2/))) &
+ call abort
+end program
+
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/where_16.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/where_16.f90
new file mode 100644
index 0000000..19f012a
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/where_16.f90
@@ -0,0 +1,39 @@
+! Check whether nested WHEREs work
+program where_16
+ integer :: a(9)
+ integer :: b(9)
+ integer :: c(9)
+
+ a = (/0, 0, 0, 1, 1, 1, 2, 2, 2/)
+ b = (/0, 1, 2, 0, 1, 2, 0, 1, 2/)
+ c = (/0, 0, 0, 0, 0, 0, 0, 0, 0/)
+
+ where (a .eq. 0)
+ where (b .eq. 0)
+ c = 1
+ else where (b .eq. 1)
+ c = 2
+ else where
+ c = 3
+ endwhere
+ elsewhere (a .eq. 1)
+ where (b .eq. 0)
+ c = 4
+ else where (b .eq. 1)
+ c = 5
+ else where
+ c = 6
+ endwhere
+ elsewhere
+ where (b .eq. 0)
+ c = 7
+ else where (b .eq. 1)
+ c = 8
+ else where
+ c = 9
+ endwhere
+ endwhere
+ if (any (c .ne. (/1, 2, 3, 4, 5, 6, 7, 8, 9/))) &
+ call abort
+end program
+