https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #8 from lin1.hu at intel dot com --- (In reply to Andrew Pinski from comment #6) > Note `c - y - c` to become `-y` reduces the possible of an overflow and is > well defined for wrapping so this might be still on purpose as there will > never be an overflow that causes difference if assuming wrapping ... Indeed, so for -fsanitize=undefined, `c - y - c` become `-y` is right. It's just missing the optimization to turn `z = c - y - c + a + y - b` into `z = a - b`.