From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15685 invoked by alias); 26 Mar 2003 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 15621 invoked by uid 71); 26 Mar 2003 21:56:01 -0000 Date: Wed, 26 Mar 2003 22:06:00 -0000 Message-ID: <20030326215601.15620.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Michael Marks Subject: RE: c/10226: unsigned short promotion with bitwise inversion Reply-To: Michael Marks X-SW-Source: 2003-03/txt/msg01844.txt.bz2 List-Id: The following reply was made to PR c/10226; it has been noted by GNATS. From: Michael Marks To: 'Glen Nakamura' , Falk Hueffner Cc: Michael Marks , gcc-gnats@gcc.gnu.org Subject: RE: c/10226: unsigned short promotion with bitwise inversion Date: Wed, 26 Mar 2003 13:50:29 -0800 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C2F3E1.B7E36740 Content-Type: text/plain; charset="iso-8859-1" Either is far clearer than the original. I like the second one better. Just one other comment, are both promoted, and are both unsigned after the promotion. I thought they are promoted to int. As per you earlier... The ~ operator is subject to integer promotion, so with the implicit conversions the expression becomes: if ((int) B == ~((int) A)) which is indeed false in the example above. But like I said earlier, either message below is far clearer. Thanks, Michael. -----Original Message----- From: Glen Nakamura [mailto:glen@imodulo.com] Sent: Wednesday, March 26, 2003 1:49 PM To: Falk Hueffner Cc: Michael Marks; gcc-gnats@gcc.gnu.org Subject: Re: c/10226: unsigned short promotion with bitwise inversion On Wed, Mar 26, 2003 at 10:39:43PM +0100, Falk Hueffner wrote: > Indeed. Currently, it says: > warning: comparison of promoted ~unsigned with unsigned > Suggestion: > warning: comparison of ~(promoted unsigned) with unsigned How about one of these: warning: comparison of promoted ~unsigned with unsigned is always false warning: comparison of ~(promoted unsigned) with unsigned is always false - glen ------_=_NextPart_001_01C2F3E1.B7E36740 Content-Type: text/html; charset="iso-8859-1" RE: c/10226: unsigned short promotion with bitwise inversion

Either is far clearer than the original. 
I like the second one better.

Just one other comment, are both promoted, and are both unsigned after the promotion.
I thought they are promoted to int. As per you earlier...

The ~ operator is subject to integer promotion,
so with the implicit conversions the expression becomes:
  if ((int) B == ~((int) A))
which is indeed false in the example above.

But like I said earlier, either message below is far clearer.

Thanks,
Michael.

-----Original Message-----
From: Glen Nakamura [mailto:glen@imodulo.com]
Sent: Wednesday, March 26, 2003 1:49 PM
To: Falk Hueffner
Cc: Michael Marks; gcc-gnats@gcc.gnu.org
Subject: Re: c/10226: unsigned short promotion with bitwise inversion


On Wed, Mar 26, 2003 at 10:39:43PM +0100, Falk Hueffner wrote:
> Indeed. Currently, it says:
> warning: comparison of promoted ~unsigned with unsigned
> Suggestion:
> warning: comparison of ~(promoted unsigned) with unsigned

How about one of these:
warning: comparison of promoted ~unsigned with unsigned is always false
warning: comparison of ~(promoted unsigned) with unsigned is always false

- glen

------_=_NextPart_001_01C2F3E1.B7E36740--