https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81148
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- w/o ubsan we fold this all the way to one. With ubsan we fold it as bool a = -((long int) ~(x != 0) ^ 9223372036854775806) + -124 != 0; so there's some stupid TYPE_OVERFLOW_SANITIZED check in the way somewhere. It looks association related again, I will have a look.