This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 05 Jun 2015 15:28:18 +0000
- Subject: [Bug c/66348] Simple loop has only lower half of the 64-bit counter initialized correctly
- Auto-submitted: auto-generated
- References: <bug-66348-4 at http dot gcc dot gnu dot org/bugzilla/>
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.