https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101691
Bug ID: 101691 Summary: d: Use of LOOP_EXPR prevents removing no-op loops. Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- As observed on compiler explorer. https://d.godbolt.org/z/eM8Pv91eT The C, C++ (and Fortran?) front-ends lower loops as labels and gotos, which *is* optimized away. https://godbolt.org/z/8Yz9oqx63 --- void fun(int a, int b, int step) { for (int i = a; i < b; i += step) { } }