This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Warning patrol: a question.


> 
> 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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]