This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning patrol: a question.
- To: jan dot vanmale at fenk dot wau dot nl
- Subject: Re: Warning patrol: a question.
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Wed, 27 Jun 2001 11:24:15 -0700 (PDT)
- Cc: gcc at gcc dot gnu dot org
>
> Hi,
>
> I need some advise on this before proceeding.
> There are about 30 warnings in the bootstrap of the type
>
> warning: comparison between signed and unsigned
>
> which are related to shift instructions. Typically, the offending code
> looks similar to
>
> INTVAL (XEXP (op0, 1)) == GET_MODE_BITSIZE (mode) - 1)
>
> where we know that op0 is a shift instruction.
But this is an equality comparison. The reason for a warning is to tell
the user about a possible surprising result, namely that the comparison is
done in unsigned mode. But the surprising results happen only for <, <=,
>=, and >, not for == and != (since signed and unsigned comparisons
produce the same answer).
So why do we get a warning for this comparison?