From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24928 invoked by alias); 22 Oct 2002 21:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24912 invoked by uid 71); 22 Oct 2002 21:56:01 -0000 Date: Tue, 22 Oct 2002 14:56:00 -0000 Message-ID: <20021022215601.24911.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/168: Spurious warning in 2.95.2 Reply-To: Wolfgang Bangerth X-SW-Source: 2002-10/txt/msg00838.txt.bz2 List-Id: The following reply was made to PR c++/168; it has been noted by GNATS. From: Wolfgang Bangerth To: gcc-bugs@gcc.gnu.org, , , Cc: Subject: Re: c++/168: Spurious warning in 2.95.2 Date: Tue, 22 Oct 2002 16:48:33 -0500 (CDT) This is equally well a C report as a C++ report, since the problem appears with both languages. The questionably code is ---------------------------------- int main () { unsigned char uc; unsigned short int usi; unsigned int ui; if (uc + usi >= ui); } ---------------------------------- and the report is that this issues an error t.i:5: warning: comparison between signed and unsigned As Jason pointed out, this is due to the fact that the left hand side is converted to an integer. I have no opinion about the validity or the warning, people should use casts to avoid this. I just wanted to share the reduced code. This may be something for value range propagation, since then it would be clear that the left hand side must be positive. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth