http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60578
--- Comment #2 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Andrew Pinski from comment #1)
> J and n are both uninitialized so there is undefined code and the result is
> different between x86 and amd64 due to different register being selected and
> it just happens the amd64 one register was set to zero. So invalid set j and
> n.
Andrew, no, the code doesn't have any undefined behavior. If you look at the
code more carefully, you'll see that neither
for (; j;)
m = 0;
(because i = 0, so the loop body isn't executed)
nor
for (; n;)
;
(because (c ^ 0L) < -1 is true in 64-bit, so the code returns)
is executed.
I think the issue is that integer promotion for "(c ^ 0L) < -1" isn't correct.