https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #2 from lin1.hu at intel dot com --- (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, c https://godbolt.org/z/Wbzx5Edsj