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/minlocval_4.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/minlocval_4.f90')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gfortran.dg/minlocval_4.f90 | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/minlocval_4.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/minlocval_4.f90 new file mode 100644 index 000000000..c42b01944 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/minlocval_4.f90 @@ -0,0 +1,120 @@ +! { dg-do run } +! { dg-add-options ieee } +! { dg-skip-if "NaN not supported" { spu-*-* } { "*" } { "" } } + real :: a(3,3), b(3), nan, minf, pinf, h + logical :: l, l2 + logical :: l3(3,3), l4(3,3), l5(3,3) + + nan = 0.0 + minf = 0.0 + pinf = 0.0 + nan = 0.0/nan + minf = -1.0/minf + pinf = 1.0/pinf + h = huge(h) + l = .false. + l2 = .true. + l3 = .false. + l4 = .true. + l5 = .true. + l5(1,1) = .false. + l5(1,2) = .false. + l5(2,3) = .false. + a = reshape ((/ nan, nan, nan, pinf, pinf, pinf, pinf, minf, pinf /), (/ 3, 3 /)) + if (minval (a).ne.minf) call abort + if (any (minloc (a).ne.(/ 2, 3 /))) call abort + b = minval (a, dim = 1) + if (.not.isnan(b(1))) call abort + b(1) = 0.0 + if (any (b.ne.(/ 0.0, pinf, minf /))) call abort + if (any (minloc (a, dim = 1).ne.(/ 1, 1, 2 /))) call abort + b = minval (a, dim = 2) + if (any (b.ne.(/ pinf, minf, pinf /))) call abort + if (any (minloc (a, dim = 2).ne.(/ 2, 3, 2 /))) call abort + if (minval (a, mask = l).ne.h) call abort + if (any (minloc (a, mask = l).ne.(/ 0, 0 /))) call abort + b = minval (a, dim = 1, mask = l) + if (any (b.ne.(/ h, h, h /))) call abort + if (any (minloc (a, dim = 1, mask = l).ne.(/ 0, 0, 0 /))) call abort + b = minval (a, dim = 2, mask = l) + if (any (b.ne.(/ h, h, h /))) call abort + if (any (minloc (a, dim = 2, mask = l).ne.(/ 0, 0, 0 /))) call abort + if (minval (a, mask = l3).ne.h) call abort + if (any (minloc (a, mask = l3).ne.(/ 0, 0 /))) call abort + b = minval (a, dim = 1, mask = l3) + if (any (b.ne.(/ h, h, h /))) call abort + if (any (minloc (a, dim = 1, mask = l3).ne.(/ 0, 0, 0 /))) call abort + b = minval (a, dim = 2, mask = l3) + if (any (b.ne.(/ h, h, h /))) call abort + if (any (minloc (a, dim = 2, mask = l3).ne.(/ 0, 0, 0 /))) call abort + if (minval (a, mask = l2).ne.minf) call abort + if (minval (a, mask = l4).ne.minf) call abort + if (any (minloc (a, mask = l2).ne.(/ 2, 3 /))) call abort + if (any (minloc (a, mask = l4).ne.(/ 2, 3 /))) call abort + b = minval (a, dim = 1, mask = l2) + if (.not.isnan(b(1))) call abort + b(1) = 0.0 + if (any (b.ne.(/ 0.0, pinf, minf /))) call abort + if (any (minloc (a, dim = 1, mask = l2).ne.(/ 1, 1, 2 /))) call abort + b = minval (a, dim = 2, mask = l2) + if (any (b.ne.(/ pinf, minf, pinf /))) call abort + if (any (minloc (a, dim = 2, mask = l2).ne.(/ 2, 3, 2 /))) call abort + b = minval (a, dim = 1, mask = l4) + if (.not.isnan(b(1))) call abort + b(1) = 0.0 + if (any (b.ne.(/ 0.0, pinf, minf /))) call abort + if (any (minloc (a, dim = 1, mask = l2).ne.(/ 1, 1, 2 /))) call abort + b = minval (a, dim = 2, mask = l4) + if (any (b.ne.(/ pinf, minf, pinf /))) call abort + if (any (minloc (a, dim = 2, mask = l2).ne.(/ 2, 3, 2 /))) call abort + if (minval (a, mask = l5).ne.pinf) call abort + if (any (minloc (a, mask = l5).ne.(/ 2, 2 /))) call abort + b = minval (a, dim = 1, mask = l5) + if (.not.isnan(b(1))) call abort + b(1) = 0.0 + if (any (b.ne.(/ 0.0, pinf, pinf /))) call abort + if (any (minloc (a, dim = 1, mask = l5).ne.(/ 2, 2, 1 /))) call abort + b = minval (a, dim = 2, mask = l5) + if (any (b.ne.(/ pinf, pinf, pinf /))) call abort + if (any (minloc (a, dim = 2, mask = l5).ne.(/ 3, 2, 2 /))) call abort + a = nan + if (.not.isnan(minval (a))) call abort + if (minval (a, mask = l).ne.h) call abort + if (.not.isnan(minval (a, mask = l2))) call abort + if (minval (a, mask = l3).ne.h) call abort + if (.not.isnan(minval (a, mask = l4))) call abort + if (.not.isnan(minval (a, mask = l5))) call abort + if (any (minloc (a).ne.(/ 1, 1 /))) call abort + if (any (minloc (a, mask = l).ne.(/ 0, 0 /))) call abort + if (any (minloc (a, mask = l2).ne.(/ 1, 1 /))) call abort + if (any (minloc (a, mask = l3).ne.(/ 0, 0 /))) call abort + if (any (minloc (a, mask = l4).ne.(/ 1, 1 /))) call abort + if (any (minloc (a, mask = l5).ne.(/ 2, 1 /))) call abort + a = pinf + if (minval (a).ne.pinf) call abort + if (minval (a, mask = l).ne.h) call abort + if (minval (a, mask = l2).ne.pinf) call abort + if (minval (a, mask = l3).ne.h) call abort + if (minval (a, mask = l4).ne.pinf) call abort + if (minval (a, mask = l5).ne.pinf) call abort + if (any (minloc (a).ne.(/ 1, 1 /))) call abort + if (any (minloc (a, mask = l).ne.(/ 0, 0 /))) call abort + if (any (minloc (a, mask = l2).ne.(/ 1, 1 /))) call abort + if (any (minloc (a, mask = l3).ne.(/ 0, 0 /))) call abort + if (any (minloc (a, mask = l4).ne.(/ 1, 1 /))) call abort + if (any (minloc (a, mask = l5).ne.(/ 2, 1 /))) call abort + a = nan + a(1,3) = pinf + if (minval (a).ne.pinf) call abort + if (minval (a, mask = l).ne.h) call abort + if (minval (a, mask = l2).ne.pinf) call abort + if (minval (a, mask = l3).ne.h) call abort + if (minval (a, mask = l4).ne.pinf) call abort + if (minval (a, mask = l5).ne.pinf) call abort + if (any (minloc (a).ne.(/ 1, 3 /))) call abort + if (any (minloc (a, mask = l).ne.(/ 0, 0 /))) call abort + if (any (minloc (a, mask = l2).ne.(/ 1, 3 /))) call abort + if (any (minloc (a, mask = l3).ne.(/ 0, 0 /))) call abort + if (any (minloc (a, mask = l4).ne.(/ 1, 3 /))) call abort + if (any (minloc (a, mask = l5).ne.(/ 1, 3 /))) call abort +end |