diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/maxlocval_2.f90 | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/maxlocval_2.f90')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gfortran.dg/maxlocval_2.f90 | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/maxlocval_2.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/maxlocval_2.f90 new file mode 100644 index 000000000..5f6b913b0 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/maxlocval_2.f90 @@ -0,0 +1,155 @@ +! { dg-do run } +! { dg-add-options ieee } +! { dg-skip-if "NaN not supported" { spu-*-* } { "*" } { "" } } + real :: a(3), nan, minf, pinf + real, allocatable :: c(:) + logical :: l + logical :: l2(3) + + nan = 0.0 + minf = 0.0 + pinf = 0.0 + nan = 0.0/nan + minf = -1.0/minf + pinf = 1.0/pinf + + allocate (c(3)) + a(:) = nan + if (maxloc (a, dim = 1).ne.1) call abort + if (.not.isnan(maxval (a, dim = 1))) call abort + a(:) = minf + if (maxloc (a, dim = 1).ne.1) call abort + if (maxval (a, dim = 1).ne.minf) call abort + a(1:2) = nan + if (maxloc (a, dim = 1).ne.3) call abort + if (maxval (a, dim = 1).ne.minf) call abort + a(2) = 1.0 + if (maxloc (a, dim = 1).ne.2) call abort + if (maxval (a, dim = 1).ne.1) call abort + a(2) = pinf + if (maxloc (a, dim = 1).ne.2) call abort + if (maxval (a, dim = 1).ne.pinf) call abort + c(:) = nan + if (maxloc (c, dim = 1).ne.1) call abort + if (.not.isnan(maxval (c, dim = 1))) call abort + c(:) = minf + if (maxloc (c, dim = 1).ne.1) call abort + if (maxval (c, dim = 1).ne.minf) call abort + c(1:2) = nan + if (maxloc (c, dim = 1).ne.3) call abort + if (maxval (c, dim = 1).ne.minf) call abort + c(2) = 1.0 + if (maxloc (c, dim = 1).ne.2) call abort + if (maxval (c, dim = 1).ne.1) call abort + c(2) = pinf + if (maxloc (c, dim = 1).ne.2) call abort + if (maxval (c, dim = 1).ne.pinf) call abort + l = .false. + l2(:) = .false. + a(:) = nan + if (maxloc (a, dim = 1, mask = l).ne.0) call abort + if (maxval (a, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (a, dim = 1, mask = l2).ne.0) call abort + if (maxval (a, dim = 1, mask = l2).ne.-huge(minf)) call abort + a(:) = minf + if (maxloc (a, dim = 1, mask = l).ne.0) call abort + if (maxval (a, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (a, dim = 1, mask = l2).ne.0) call abort + if (maxval (a, dim = 1, mask = l2).ne.-huge(minf)) call abort + a(1:2) = nan + if (maxloc (a, dim = 1, mask = l).ne.0) call abort + if (maxval (a, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (a, dim = 1, mask = l2).ne.0) call abort + if (maxval (a, dim = 1, mask = l2).ne.-huge(minf)) call abort + a(2) = 1.0 + if (maxloc (a, dim = 1, mask = l).ne.0) call abort + if (maxval (a, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (a, dim = 1, mask = l2).ne.0) call abort + if (maxval (a, dim = 1, mask = l2).ne.-huge(minf)) call abort + a(2) = pinf + if (maxloc (a, dim = 1, mask = l).ne.0) call abort + if (maxval (a, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (a, dim = 1, mask = l2).ne.0) call abort + if (maxval (a, dim = 1, mask = l2).ne.-huge(minf)) call abort + c(:) = nan + if (maxloc (c, dim = 1, mask = l).ne.0) call abort + if (maxval (c, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (c, dim = 1, mask = l2).ne.0) call abort + if (maxval (c, dim = 1, mask = l2).ne.-huge(minf)) call abort + c(:) = minf + if (maxloc (c, dim = 1, mask = l).ne.0) call abort + if (maxval (c, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (c, dim = 1, mask = l2).ne.0) call abort + if (maxval (c, dim = 1, mask = l2).ne.-huge(minf)) call abort + c(1:2) = nan + if (maxloc (c, dim = 1, mask = l).ne.0) call abort + if (maxval (c, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (c, dim = 1, mask = l2).ne.0) call abort + if (maxval (c, dim = 1, mask = l2).ne.-huge(minf)) call abort + c(2) = 1.0 + if (maxloc (c, dim = 1, mask = l).ne.0) call abort + if (maxval (c, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (c, dim = 1, mask = l2).ne.0) call abort + if (maxval (c, dim = 1, mask = l2).ne.-huge(minf)) call abort + c(2) = pinf + if (maxloc (c, dim = 1, mask = l).ne.0) call abort + if (maxval (c, dim = 1, mask = l).ne.-huge(minf)) call abort + if (maxloc (c, dim = 1, mask = l2).ne.0) call abort + if (maxval (c, dim = 1, mask = l2).ne.-huge(minf)) call abort + l = .true. + l2(:) = .true. + a(:) = nan + if (maxloc (a, dim = 1, mask = l).ne.1) call abort + if (.not.isnan(maxval (a, dim = 1, mask = l))) call abort + if (maxloc (a, dim = 1, mask = l2).ne.1) call abort + if (.not.isnan(maxval (a, dim = 1, mask = l2))) call abort + a(:) = minf + if (maxloc (a, dim = 1, mask = l).ne.1) call abort + if (maxval (a, dim = 1, mask = l).ne.minf) call abort + if (maxloc (a, dim = 1, mask = l2).ne.1) call abort + if (maxval (a, dim = 1, mask = l2).ne.minf) call abort + a(1:2) = nan + if (maxloc (a, dim = 1, mask = l).ne.3) call abort + if (maxval (a, dim = 1, mask = l).ne.minf) call abort + if (maxloc (a, dim = 1, mask = l2).ne.3) call abort + if (maxval (a, dim = 1, mask = l2).ne.minf) call abort + a(2) = 1.0 + if (maxloc (a, dim = 1, mask = l).ne.2) call abort + if (maxval (a, dim = 1, mask = l).ne.1) call abort + if (maxloc (a, dim = 1, mask = l2).ne.2) call abort + if (maxval (a, dim = 1, mask = l2).ne.1) call abort + a(2) = pinf + if (maxloc (a, dim = 1, mask = l).ne.2) call abort + if (maxval (a, dim = 1, mask = l).ne.pinf) call abort + if (maxloc (a, dim = 1, mask = l2).ne.2) call abort + if (maxval (a, dim = 1, mask = l2).ne.pinf) call abort + c(:) = nan + if (maxloc (c, dim = 1, mask = l).ne.1) call abort + if (.not.isnan(maxval (c, dim = 1, mask = l))) call abort + if (maxloc (c, dim = 1, mask = l2).ne.1) call abort + if (.not.isnan(maxval (c, dim = 1, mask = l2))) call abort + c(:) = minf + if (maxloc (c, dim = 1, mask = l).ne.1) call abort + if (maxval (c, dim = 1, mask = l).ne.minf) call abort + if (maxloc (c, dim = 1, mask = l2).ne.1) call abort + if (maxval (c, dim = 1, mask = l2).ne.minf) call abort + c(1:2) = nan + if (maxloc (c, dim = 1, mask = l).ne.3) call abort + if (maxval (c, dim = 1, mask = l).ne.minf) call abort + if (maxloc (c, dim = 1, mask = l2).ne.3) call abort + if (maxval (c, dim = 1, mask = l2).ne.minf) call abort + c(2) = 1.0 + if (maxloc (c, dim = 1, mask = l).ne.2) call abort + if (maxval (c, dim = 1, mask = l).ne.1) call abort + if (maxloc (c, dim = 1, mask = l2).ne.2) call abort + if (maxval (c, dim = 1, mask = l2).ne.1) call abort + c(2) = pinf + if (maxloc (c, dim = 1, mask = l).ne.2) call abort + if (maxval (c, dim = 1, mask = l).ne.pinf) call abort + if (maxloc (c, dim = 1, mask = l2).ne.2) call abort + if (maxval (c, dim = 1, mask = l2).ne.pinf) call abort + deallocate (c) + allocate (c(-2:-3)) + if (maxloc (c, dim = 1).ne.0) call abort + if (maxval (c, dim = 1).ne.-huge(minf)) call abort +end |