https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101691
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- cannot prove finiteness of loop 1 Note the C code you posted is not the same as the D code. Using int is able to optimize away for C++ code but not for C code. The reason why it is able to optimize away for C++ code is because -ffinite-loops is turned on there.