https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119797

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is a patch which should improve/fix this situtation proposed for GCC 16
(it was actually submitted a few months ago but reviews on it has been slow).

Basically because of optimization (jump threading) we know in some cases r will
be out of bounds.

In Bug, either add:
if (r >= std::size(BUG))
  std::unreachable (); // or //__builtin_unreachable();

or something similar at the begining of the function to signal that r being
greater than the size of the BUG array is invalid.

Reply via email to