optimisation of overflowing integers

N.M. Maclaren nmm1@cam.ac.uk
Tue Mar 18 09:29:00 GMT 2014


On Mar 18 2014, Tobias Burnus 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

Congratulations to those responsible!  I will update my courses, as soon
as I get a moment.

I haven't checked, but it would be worth rechecking the bug-reporting
instructions (if it has not been done), as that check could throw out
quite a few 'optimisation bugs'.


Regards,
Nick Maclaren.



More information about the Fortran mailing list