https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90387
--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Bernd Buschinski from comment #6) > From the comments I assumed that the fix is kind of trivial There is a simple change that gives the behavior you want on one example, but it is far from trivial whether that is generally a good idea. Giving up on __builtin_constant_p earlier (there are quite a few passes between vrp1 and dom2) means that there are cases where we will say 'false' while we were able to say 'true' before, which is a missed optimization. On the other hand, the more complicated CFG created by _bcp may hinder some other optimizations, so it may also help. The question is how often that will happen and how important those cases are. Honestly, false positives with Warray-bounds are a secondary concern, you can just disable the warning, like Wmaybe-uninitialized and a few others that are meant to have false positives.