https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178
--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Yes, though I think we should fix the Fortran FE so that it only relies on [0, N) . If the shift count is constant, it can deal with it at compile time, if it is variable, can emit a COND_EXPR for the shift_count == N case.