http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60578

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
But why do you think (c ^ 0L) < -1 is 1 for 64-bit mode?
>From C99, 6.3.1.8, different paragraphs apply:
"Otherwise, if the type of the operand with signed integer type can represent
all of the values of the type of the operand with unsigned integer type, then
the operand with unsigned integer type is converted to the type of the
operand with signed integer type.

Otherwise, both operands are converted to the unsigned integer type
corresponding to the type of the operand with signed integer type."

For 64-bit mode, the first cited paragraph applies, because 64-bit long int can
represent all of values of 32-bit unsigned int, so it is
(((long int) 0) ^ 0L) < -1L and thus 0L < -1L and therefore false.

For 32-bit mode, the second cited paragraph applies, because 32-bit long int
can't represent all of values of 32-bit unsigned int, so it is
(((unsigned long int) 0) ^ 0UL) < -1UL and thus 0UL < -1UL and therefore true.

Reply via email to