https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #3 from lin1.hu at intel dot com --- (In reply to lin1.hu from comment #2) > (In reply to Andrew Pinski from comment #1) > > Gcc's trapv is known not always to work correctly. > > > > Try -fsanitize=undefined instead. Thanks, it solves the problem to some extent. But c is eliminated, I think c - y may cause signed overflow. https://godbolt.org/z/Wbzx5Edsj