https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66348
--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Sebastiano Vigna from comment #0) > The loop commented as "problematic loop" is compiled (with -O3) as > > xorl %eax, %eax # i > > That is, the loop index i is in %rax, but only the lower half is zeroed at > the start of the loop. When we enter the loop with a large (>32-bit) value, > the loop never ends. This happens already with -O1. We had to #pragma the > function to -O0 to make it work. If you are referring to the xorl insn above, then rest assured that it zeroes the whole 64bit register. Your bug is elsewhere.