2 ms·
GCC does take advantage of the forward progress guarantee in other cases, but seemingly only in c++ mode; see https://godbolt.org/z/Won5zETKx https://godbolt.or
by moonchild 4y ago
GCC does take advantage of the forward progress guarantee in other cases, but seemingly only in c++ mode; see https://godbolt.org/z/Won5zETKx https://godbolt.org/z/Won5zETKx. I wonder why.
C provides forward progress guarantees only for loops, whereas C++ provides them for all code. Perhaps GCC did not want to bother to annotate individual control edges (as llvm does with 'mustprogress'), and they perform such optimisations after canonicalising loops and other irregular mechanisms for control flow into a homogenous CFG.