This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: warning: right shift count >= width of type
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Chris Jefferson'" <caj at cs dot york dot ac dot uk>
- Cc: "'Dale Johannesen'" <dalej at apple dot com>,<gcc at gcc dot gnu dot org>,"'Andrew Haley'" <aph at redhat dot com>,"'Nathan Sidwell'" <nathan at codesourcery dot com>
- Date: Mon, 29 Nov 2004 18:27:45 -0000
- Subject: RE: warning: right shift count >= width of type
> -----Original Message-----
> From: Chris Jefferson
> Sent: 29 November 2004 17:13
> > So my question is really "Given that it's undefined, which
> means that
> >whatever the compiler does is correct, and given that
> there's already code
> >in there to detect the situation and issue a warning, which
> probably means
> >that it would be very easy at such a point to replace the
> offending RTL with
> >(const_int 0), is there any specific reason why not to?"
> >
> One reason (of course) not to would be if you are bit-shifting by a
> variable. Adding a check at runtime to see if the value of
> this variable
> is <32 and if not setting the variable to zero would be
> frowned upon by
> many people, particuarily because the kind of people who undertake
> bitshifting are doing it for performance-related reasons...
>
> Chris
What on earth made you suppose I would for one instant suggest anything so
ridiculous? I was talking about static compile-time checking.
cheers,
DaveK
--
Can't think of a witty .sigline today....