[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (1 << -1) ?
> Date: Sat, 14 Sep 2002 16:36:04 +0200
> From: Sebastian Andersson <email@example.com>
> I've noticed a difference in the semantics between gcc-2.95 and gcc-3.0
> on i386 and the cris-1.15 version of gcc-2.96.
> This lines:
> printf("%u\n", 1<<(-1));
> gives 0 the cris and 2147483648 on i386.
> Since gcc gives a warning about this, I assume the result
> is undefined in the ISO C standard, is that correct
> is there a bug in the cris version of gcc?
Not in this regard. An undefined result is undefined and the
results are valid for both ports.
Note that cris-dist-1.15 is several versions back; I advise you