Hello, > >I have been looking into infer_loop_bounds_from_signedness() called > >from infer_loop_bounds_from_undefined(). > >At some places, nowrap_type_p() is used but this function operates > >only on types, so there will be too many false positive there; yet we > >will miss warning through that case. > > I don't know that area too well, but I think we are already issuing a > warning if we use -funsafe-loop-optimizations, so it might be possible > to do the same if we use signed wrapping undefinedness.
not quite; -funsafe-loop-optimizations is not used in scev analysis itself, only in # of iterations analysis. At some extra compile-time cost, you can check whether we use undefinedness of signed overflow throughout the scev analysis, but there is no way how to avoid duplicate warnings, and even making the positioning and contents of the warnings sensible would be nontrivial. Zdenek