https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103220
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2021-11-20 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This actually reduces down to just: unsigned char f(unsigned char a) { signed char d = (signed char) a; signed char e = d & ~1; unsigned char t = e; t &= ~2; return t; } Not reducing to: unsigned char f1(unsigned char a) { return a & ~3; } Most likely because of the int_fits_type_p in match.pd which returns false when switching signs. Let me look into that issue.