https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348
--- Comment #2 from Sebastiano Vigna <sebastiano.vigna at unimi dot it> --- Er... it's perfectly possible. My knowledge of x64 assembly is rudimentary, but I wanted to try a diagnosis. What is definitely true is that at -O0 we enter and exit the loop as it should happen, and at -O1 we never exit the loop. For the time being we are #pragma'ing the function to remove optimizations.