optimisation of overflowing integers

Tobias Burnus burnus@net-b.de
Tue Mar 18 06:53:00 GMT 2014


N.M. Maclaren wrote:
> The errors occur at run-time - NAG Fortran is the only currently active
> Fortran compiler that checks for such things (and you need -C=all).
> So the answers are "no" and "no".

Try GCC/gfortran 4.9 (with the bug fix patch to PR60557), namely:

$ gfortran -fsanitize=undefined bar.f90
$ ./a.out
bar.f90:19: runtime error: signed integer overflow: 809078955 * 65539 
cannot be represented in type 'integer(kind=4)'
   0.290384561       623596113

Tobias



More information about the Fortran mailing list