https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82776
--- Comment #6 from amker at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #5) > (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. Base IVs are a bit special and different to existing undefined behavior here. IIUC, non-wrap has been assumed all the places in IV/SCEV analysis and that information has been used in niter analysis without flag_aggressive_loop_optimizations already. > 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.