https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118259
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I am 99% sure this is undefined Fortran code and you either need to use -fwrapv or the new Fortran 202X unsigned type to get this to be defined. That is integer types are signed and signed integer overflow is undefined in Fortran still.