[PATCH, i386]: Fix target/35944, [4.3, 4.4 regression] wrong result for MOD with kind=10 for some array argument values

FX fxcoudert@gmail.com
Wed Apr 16 18:39:00 GMT 2008


Hi Uros,

Here are two testcases that should cover both the real(kind=10) and
also the standard float and double floating point types:

$ cat z1.f90
! { dg-do run }

  implicit none
  integer i
  real rda1(10), rda(10), rval
  double precision dda1(10), dda(10), dval

  rda = (/ 1,2,3,4,5,6,7,8,9,10 /)
  rDA1 = MOD (1.1*(rDA(1)-5.0), P=(rDA-2.5))
  DO i = 1, 10
    rVAL = MOD (1.1*(rDA(1)-5.0), P=(rDA(i)-2.5))
    if (rval /= rda1(i)) call abort
  enddo

  dda = (/ 1,2,3,4,5,6,7,8,9,10 /)
  dDA1 = MOD (1.1d0*(dDA(1)-5.0d0), P=(dDA-2.5d0))
  DO i = 1, 10
    dVAL = MOD (1.1d0*(dDA(1)-5.0d0), P=(dDA(i)-2.5d0))
    if (dval /= dda1(i)) call abort
  enddo

end

$ cat z2.f90
! { dg-do run }
! { dg-require-effective-target fortran_large_real }

  implicit none
  integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
  integer :: i
  real(k) :: qda1(10), qda(10), qval

  qda = (/ 1,2,3,4,5,6,7,8,9,10 /)
  QDA1 = MOD (1.1_k*(QDA(1)-5.0_k), P=(QDA-2.5_k))
  DO i = 1, 10
    QVAL = MOD (1.1_k*(QDA(1)-5.0_k), P=(QDA(i)-2.5_k))
    if (qval /= qda1(i)) call abort
  enddo
end


Thanks for fixing this issue,
FX

-- 
FX Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Fortran mailing list