http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52267
Bug #: 52267 Summary: a&~N where N has all the bits set up till a specific point can be folded to ((unsigned)a) < N Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: pins...@gcc.gnu.org Take the following two functions. int f(int a, int b) { if (a>3||a<0) return a; a&=3; return a&3; } int f1(int a) { if (a&~03) return a; return a&3; } They should return just the argument. Right now the first function does but not the second.