Take: int d; int f(int a) { return d = (a-1)/2; } --- CUT --- With -O2 -fdump-tree-final_cleanup, we get: d.0 = a + -1 / 2;
This looks like we are missing the optimization of folding the constant -1/2 which is not true as this is really (a + -1) / 2 . In 4.3.3 we get: d.0 = (a + -1) / 2; Which is correct. -- Summary: [4.4 Regression] Missing parentheses for (a-1)/2 in final_cleanup Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38690