https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118657
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andi Kleen from comment #3) > I don't think you need range analysis for this, just the constexpr array > lookup needs to supply a constant. In the simplified testcase, saying all values of the array is the same and zero is OK for that but as mentioned below the referenced simplified testcase was simplified too much. Having a full range of the values inside the array would improve other code besides bounds checking too.