KL Guest
|
Posted: Mon Dec 18, 2006 10:24 am Post subject: Test_Overflow |
|
|
The following problem reveals still a problem with integer overflow. I have run the case with FTN95 v5.0 and the bat file:
del comp.lis
del *.obj
del *.exe
ftn95 Test_Overflow.f95 /checkmate /underflow /link >> comp.lis
sdbg Test_Overflow.exe
The program is:
Winapp
Program Test_overflow
Implicit None
! For iKind = selected_int_kind (9) overflow works correctly
! ###########################################################
Integer , Parameter :: iKind = selected_int_kind (4)
Integer (iKind) :: i, k
write (*,*) ' Results of Program Test_overflow'
write (*,*) ' ================================'
write (*,*)
write (*,*) ' iKind = ', iKind
write (*,*) ' Huge (i) = ', Huge (i)
write (*,*)
! For the Do Loop index i = 5, an error message should be given and
! a program stop should occur;
! instead wrong values are given for the variable k; please see output.
k = 10_iKind
Do i = 1, 10
write (*,*) ' Do-Loop index i = ', i, ' Value of k = ', k
k = k * 10_iKind
End Do
write (*,*)
write (*,*) ' The results for Do Loop index = 5,6,...,10 are completely wrong!'
write (*,*) ' ################################################################'
End Program Test_overflow
Best regards
Klaus Lassmann |
|