An example: int f(_Bool a) { int t = a; if (t != 2) return 0; return 1; } int f1(unsigned char a) { int t = a; if (t != 256) return 0; return 1; }
Both of these we can find that if statement is always true. No other pass does this currently. -- Summary: VRP does not get information from casts from a smaller precision Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23745