aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f9040
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90 b/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90
new file mode 100644
index 000000000..078a08d70
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90
@@ -0,0 +1,40 @@
+! Check we do the right thing with extreme values.
+! From PR12704
+program intrinsic_mmloc_3
+ integer, dimension(2) :: d
+ integer, dimension(2,2) :: a
+ logical, dimension(2) :: k
+ logical, dimension(2,2) :: l
+
+ k = .true.
+ l = .true.
+
+ d = -huge (d)
+ if (maxloc (d, 1) .ne. 1) call abort ()
+
+ d = huge (d)
+ if (minloc (d, 1) .ne. 1) call abort ()
+
+ d = -huge (d)
+ if (maxloc (d, 1, k) .ne. 1) call abort ()
+
+ d = huge (d)
+ if (minloc (d, 1, k) .ne. 1) call abort ()
+
+ a = -huge (a)
+ d = maxloc (a)
+ if (any (d .ne. 1)) call abort ()
+
+ a = huge (a)
+ d = minloc (a)
+ if (any (d .ne. 1)) call abort ()
+
+ a = -huge (a)
+ d = maxloc (a, l)
+ if (any (d .ne. 1)) call abort ()
+
+ a = huge (a)
+ d = minloc (a, l)
+ if (any (d .ne. 1)) call abort ()
+
+end program