https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82776
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to amker from comment #4) > Well, one decision needs to be made is whether such bound information should > be covered by -faggressive-loop-optimizations. We already did this for > undefined behavior of sign type and array bound. OTOH, this doesn't look > like too aggressive since we already rely on undefined behavior for > pointer/signed types in SCEV. Given: if (flag_aggressive_loop_optimizations) infer_loop_bounds_from_undefined (loop); I think it should be keyed on flag_aggressive_loop_optimizations. E.g. we want to avoid something like that when sanitizing etc. > Note I made change assuming non-wrap pointer all the time in r250765, but > seems some kernel code depends on that, i.e, PR82694. We may need to revert > the change and only assume non-wrap pointer when !flag_wrapv. Thanks. IMHO the kernel should be fixed, in any case, that is something to discuss in that PR, not here.