This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

test for the MOD() intrinsic


Hi All,

I was testing MOD() intrinsic, and found slight difference of handling
of second parameter to MOD() from f95 standard to f2003.

According to f95, the second parameter can be 0 (zero), and if that is
the case then the result is processor dependent. While, f2003 says, the
second parameter can not be zero. gfortran (mainline) treats it
according to f2003 std. It emit errors if the second parameter is zero.

So, my question should this case to be handled? Should gfortran, compile
the program with -std=f95 option and reject by default?

I tried compiler from 20041001, which emit errors for all the cases
except the second case when both the parameters are real with the second
parameter is 0.0.

Here is the test case.

cat test_mod.f90
program test_mod
integer :: i = 0
! case 1:
i = MOD(3, 0)     ! { dg-error "Second argument MOD" "" }

! case 2:
i = MOD(3.1, 0.0) ! { dg-error "Second argument MOD" "" }

! case 3:
i = MOD(3, 0.0)   ! { dg-error "must be the same type" "" }

! case 4:
i = MOD(3.1, 0)   ! { dg-error "must be the same type" "" }
end


Thanks,

- Uttam



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]