https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118279
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Adding: if (hoff > 2 || hoff < 0) __builtin_unreachable(); Before the loop fixed it. Note you can do `[[assume(hoff >= 0 && hoff <= 2)]];` It looks like GCC does not figure that out from the switch statement ...