This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.1.1
- From: Andreas Jaeger <aj at suse dot de>
- To: "Rob Taylor" <robt at flyingpig dot com>
- Cc: "Andreas Schwab" <schwab at suse dot de>,"Jack Lloyd" <lloyd at acm dot jhu dot edu>,"Toon Moene" <toon at moene dot indiv dot nluug dot nl>, <gcc at gcc dot gnu dot org>,<shimon at simon-shapiro dot com>
- Date: Fri, 28 Jun 2002 12:57:45 +0200
- Subject: Re: GCC 3.1.1
- References: <020a01c21e8d$45433690$9b00a8c0@highend.co.uk>
"Rob Taylor" <robt@flyingpig.com> writes:
> Andreas Schwab <schwab@suse.de> writes:
>> Jack Lloyd <lloyd@acm.jhu.edu> writes:
>>
>> |> Basically:
>> |>
>> |> unsigned long long x;
>> |> x = 1 << 32;
>> |>
>> |> results in x == 0 rather than 0x100000000 as the code expects.
>>
>> Actually this is already undefined by itself, and even x == 0 is not
>> guaranteed.
>
> why? x is an unsigned long long, surely << should be defined for values up to 63
> for this implementation?
But 1 is an int. And the expression 1 << 32 is evaluated as int. Try
1LL to get a long long constant...
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj