This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C/C++ PATCH for c/77423 (bogus warning with -Wlogical-not-parentheses)
- From: Marek Polacek <polacek at redhat dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: Joseph Myers <joseph at codesourcery dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 5 Sep 2016 14:03:29 +0200
- Subject: Re: C/C++ PATCH for c/77423 (bogus warning with -Wlogical-not-parentheses)
- Authentication-results: sourceware.org; auth=none
- References: <HE1PR0701MB2169E06960F0F1577E956BC4E4E50@HE1PR0701MB2169.eurprd07.prod.outlook.com>
On Fri, Sep 02, 2016 at 03:51:49PM +0000, Bernd Edlinger wrote:
> Hi,
>
> > + r += !a == ~b;
> > + r += !a == ~(int) b;
>
> I don't understand why ~b should not be warned at -Wall.
Yeah, there was an RFE for this but I'm not finding it.
> Frankly I don't even understand why the above statements are
> completely optimized away.
>
> r += !a == ~b;
> is optimized away, but
>
> b = ~b;
> r += !a == b;
>
> Is not. Why?
Something in ccp I suppose. But I didn't investigate closely because
it's not really relevant to this patch, sorry.
Marek