https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96615
Bug ID: 96615 Summary: Failure to optimize out loop that eventually ends but has no side effects Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- void f(int bytes) { bytes = (int)((unsigned int)bytes - 64); if (bytes > 0) f(bytes); return; } This can be optimized to doing nothing. LLVM does this transformation, but GCC does not.