https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think we rely on [0, N) in middle-end and in backends in so many places that it probably would be better to change the Fortran FE to emit for shift{l,a,r} (a, b) something like __builtin_expect (b == N, 0) ? something : a {<<,>>} b.