On Fri, Feb 15, 2019 at 03:25:33PM +0800, Bin.Cheng wrote: > So with what condition we can safely rewrite trapping operations into > non trapping one? Does the rewrite nullify -ftrapv which requires > trap behavior?
For the particular expression? Yes, otherwise no. -ftrapv should be either replaced with -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error, or at least implemented that way in the middle-end (perhaps with a separate ifn, so that we can pattern recognize it during expansion and use library calls where the inline call is not small enough). We haven't done that yet though. Jakub