optimisation of overflowing integers
N.M. Maclaren
nmm1@cam.ac.uk
Mon Mar 17 15:28:00 GMT 2014
On Mar 17 2014, Davide Mancusi wrote:
>
>I posted a question on stackoverflow concerning the way gfortran
>optimises integer arithmetics relying on variable overflow. I would
>appreciate if you guys could give it a look.
>
>
> http://stackoverflow.com/questions/22455956/gfortran-optimisation-of-overflowing-integers
Oh, yuck, RANDU! I had hoped that obscenity had rotted away years
ago. In addition to being erroneous code, it is notorious as being
one of the worst pseudo-random generators of all time.
> I was mildly shocked by the result of gfortran's optimisation. I was
> wondering: 1. does gfortran's aggressive optimisation qualify as a bug?
> 2. wouldn't gfortran's unexpected behaviour warrant at least a warning?
> Note that no warning is generated, even with -Wall -Wextra -pedantic.
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".
Regards,
Nick Maclaren.
More information about the Fortran
mailing list