bit shift bug with GCC 2.95.2 19991024 under Solaris 7
Richard Henderson
rth@redhat.com
Tue Jan 9 00:38:00 GMT 2001
On Mon, Jan 08, 2001 at 03:40:55PM -0500, John S. J. Anderson wrote:
> (note the incorrect spike). Based on ANSI C Standard, when doing a bit
> shift, both sides should be promoted to the most significant
> type. Therefore, '1 << foo' (when foo is a 64 bit int) should always
> raise 1 to 64 bits.
Incorrect. "Integral promotions" are performed on the operands
of a shift; "arithmetic promotions" are not. The two arguments
are not promoted to a common type. The result type is the same
as the type of the promoted left operand. In your example, int.
r~
More information about the Gcc-bugs
mailing list