(j3.2006) (SC22WG5.4900) [ukfortran] Comment on a comment on the WG5 letterballot on N1947
N.M. Maclaren
nmm1
Wed Jan 16 15:35:36 EST 2013
On Jan 16 2013, Bill Long wrote:
>
>In recent memory, I've only encountered one case of harmful integer
>overflow, and that occurred in converting a large real value to integer
>and was caught by the IEEE hardware traps. Of course, there are
>numerous cases, almost all related to user-written random number
>generators, where overflow of integer multiply is intentional. For
>those cases, enabling a check would cause the program to stop working.
Do none of the codes you see ever include fragments like the following?
SUBROUTINE weeble (arg)
REAL(KIND=KIND(0.0D0)) :: arg(:,:)
REAL(KIND=KIND(0.0D0)) :: scratch(UBOUND(arg,1)*(UBOUND(arg,1)+1)/2)
Being caught out by default integers being large enough for any single
dimension but not the total size of an array, and accidentally using a
calculation that creates the latter, is a very common mistake in all of
Fortran, C and C++.
Regards,
Nick Maclaren.
More information about the J3
mailing list