https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124560
--- Comment #5 from Jeevitha <jeevitha at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > No, it is the exact opposite. Going from what was undefined to defined is > ok. > What is problematic is going from being defined to being undefined. > > So I think the check in this case should be just `!TYPE_OVERFLOW_SANITIZED > (type)`. As you still want to sanitize this case. Thanks for the clarification. I have updated the patch based on your suggestion to use !TYPE_OVERFLOW_SANITIZED (type), so that the transformation applies to both signed and unsigned types. I have attached the updated patch along with the test cases.
