shifting
Zack Weinberg
zack@codesourcery.com
Thu Jul 4 01:42:00 GMT 2002
On Thu, Jul 04, 2002 at 08:25:01AM +0200, Marko Mlinar wrote:
> Hello!
>
> About some time I noticed gcc has strange "feature" with shifting.
Whenever you shift a number left or right by more than the width of
its type, the behavior is undefined -- the compiler is allowed to do
whatever it pleases.
The warning, however, should be issued at all optimization levels. I
imagine we are simply not replacing 'const int c' with '40' at -O0
early enough for the warning to happen. In general, I think that all
of GCC's warnings should be independent of the optimization level...
zw
More information about the Gcc
mailing list