https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76174
Bug ID: 76174 Summary: Missed loop optimization Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jrmuizel at gmail dot com Target Milestone: --- The call to m is not removed from the following code: void m(); void l(unsigned int r) { unsigned int q = 0; unsigned int c = r; for (unsigned int x = 0; x<r; x++) { if (q == c) { m(); c *= 2; } q++; } } if the line 'c *= 2' is removed the optimizer successfully optimizes away the body of the function.