From 5e20aef8df76663e5b8507114db9ca28ce76abae Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Mon, 11 Dec 2017 17:57:38 +0000 Subject: [PATCH] re PR fortran/83379 (Intermittent failure of min/maxval_char*.f90 test cases) 2017-12-11 Thomas Koenig PR fortran/83379 * gfortran.dg/minval_char_1.f90: Correct logic for mask calculation. * gfortran.dg/minval_char_2.f90: Likewise. * gfortran.dg/maxval_char_1.f90: Likewise. * gfortran.dg/maxval_char_2.f90: Likewise. From-SVN: r255543 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gfortran.dg/maxval_char_1.f90 | 8 ++++---- gcc/testsuite/gfortran.dg/maxval_char_2.f90 | 6 +++--- gcc/testsuite/gfortran.dg/minval_char_1.f90 | 6 +++--- gcc/testsuite/gfortran.dg/minval_char_2.f90 | 4 ++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c51c2000de0..acd4578f20e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2017-12-11 Thomas Koenig + + PR fortran/83379 + * gfortran.dg/minval_char_1.f90: Correct logic for mask + calculation. + * gfortran.dg/minval_char_2.f90: Likewise. + * gfortran.dg/maxval_char_1.f90: Likewise. + * gfortran.dg/maxval_char_2.f90: Likewise. + 2017-12-11 Thomas Koenig PR fortran/45689 diff --git a/gcc/testsuite/gfortran.dg/maxval_char_1.f90 b/gcc/testsuite/gfortran.dg/maxval_char_1.f90 index 24b5336ca83..2e529005ac2 100644 --- a/gcc/testsuite/gfortran.dg/maxval_char_1.f90 +++ b/gcc/testsuite/gfortran.dg/maxval_char_1.f90 @@ -19,10 +19,10 @@ program main res = maxval(a,dim=1) if (res /= '00030') call abort do - call random_number(r) - if (count(r>0.2) > 1) exit + call random_number(r) + v = int(r * 100) + if (count (v>20) > 1) exit end do - v = int(r * 100) write (unit=b,fmt='(I5.5)') v write (unit=res,fmt='(I5.5)') maxval(v) if (res /= maxval(b)) call abort @@ -31,7 +31,7 @@ program main smask = .false. if (all_zero /= maxval(b, smask)) call abort - mask = v < 30 + mask = v > 20 write (unit=res,fmt='(I5.5)') maxval(v,mask) if (res /= maxval(b, mask)) call abort mask = .false. diff --git a/gcc/testsuite/gfortran.dg/maxval_char_2.f90 b/gcc/testsuite/gfortran.dg/maxval_char_2.f90 index 750d18e59a8..c9ba125c330 100644 --- a/gcc/testsuite/gfortran.dg/maxval_char_2.f90 +++ b/gcc/testsuite/gfortran.dg/maxval_char_2.f90 @@ -18,9 +18,9 @@ program main if (res /= 4_'00030') call abort do call random_number(r) - if (count(r>0.2) > 1) exit + v = int(r * 100) + if (count(v > 20) > 1) exit end do - v = int(r * 100) write (unit=b,fmt='(I5.5)') v write (unit=res,fmt='(I5.5)') maxval(v) if (res /= maxval(b)) call abort @@ -29,7 +29,7 @@ program main smask = .false. if (all_zero /= maxval(b, smask)) call abort - mask = v < 30 + mask = v > 20 write (unit=res,fmt='(I5.5)') maxval(v,mask) if (res /= maxval(b, mask)) call abort mask = .false. diff --git a/gcc/testsuite/gfortran.dg/minval_char_1.f90 b/gcc/testsuite/gfortran.dg/minval_char_1.f90 index 6ffab4e98ba..4d2598ea8e4 100644 --- a/gcc/testsuite/gfortran.dg/minval_char_1.f90 +++ b/gcc/testsuite/gfortran.dg/minval_char_1.f90 @@ -17,10 +17,10 @@ program main res = minval(a) if (res /= '00026') call abort do - call random_number(r) - if (count(r<0.2) > 1) exit + call random_number(r) + v = int(r * 100) + if (count(v < 30) > 1) exit end do - v = int(r * 100) write (unit=b,fmt='(I5.5)') v write (unit=res,fmt='(I5.5)') minval(v) if (res /= minval(b)) call abort diff --git a/gcc/testsuite/gfortran.dg/minval_char_2.f90 b/gcc/testsuite/gfortran.dg/minval_char_2.f90 index 82661f015af..93ea4f6e18f 100644 --- a/gcc/testsuite/gfortran.dg/minval_char_2.f90 +++ b/gcc/testsuite/gfortran.dg/minval_char_2.f90 @@ -20,9 +20,9 @@ program main if (res /= 4_'00026') call abort do call random_number(r) - if (count(r>0.2) > 1) exit + v = int(r * 100) + if (count(v<30) > 1) exit end do - v = int(r * 100) write (unit=b,fmt='(I5.5)') v write (unit=res,fmt='(I5.5)') minval(v) if (res /= minval(b)) call abort -- 2.30.2