This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Chill warning questions #2
- To: Joe Buck <jbuck at synopsys dot com>
- Subject: Re: Chill warning questions #2
- From: Per Bothner <bothner at cygnus dot com>
- Date: Wed, 14 Oct 1998 16:48:52 -0700
- cc: egcs at cygnus dot com
>> > if (TREE_CODE (powerset) == CONSTRUCTOR & TREE_CONSTANT (powerset)
>> > && (size = int_size_in_bytes (TREE_TYPE (powerset))) >= 0)
> I think that the & should be an &&.
Correct.
> Why is this warning being issued for != and == comparisons? The
> reason for this warning is that relational comparisons (<, <=, >, >=)
> have unexpected results when comparing negative signed values to
> unsigned values. Since there is no unexpected behavior for != or
> ==, I don't believe that the compiler should warn in this case.
signed char a = -1;
unsigned char b = 0xff;
if (a == b) ...
It certainly seems to me this can be "unexpected". (I don't know what
the standard says, but I could certainly argue either way!)
However, when one of the operands is a constant less than maximum
positive value of the other operand (cast to a signed value),
as in this case, then I think the warning is just noise.
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner