https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348
--- Comment #9 from Sebastiano Vigna <sebastiano.vigna at unimi dot it> --- As I said, I was trying (a bit naively, admittedly) a diagnosis. I agree fully--I'm no expert in x86 assembly. But it is a fact that the problematic loop never exits with -O1, and exits normally with -O0. The loop does not write any memory except for the local variable ld, so if the list of pointers was broken we should get a segment violation. Instead, it simply never exits (keeping 100% CPU load).