public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>, gcc-patches@gcc.gnu.org
Subject: Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)
Date: Mon, 09 Mar 2015 16:13:00 -0000	[thread overview]
Message-ID: <54FDC69F.3000901@redhat.com> (raw)
In-Reply-To: <20150309143456.GR1746@tucnak.redhat.com>

On 03/09/2015 10:34 AM, Jakub Jelinek wrote:
> On Fri, Feb 27, 2015 at 05:29:47PM -0500, Jason Merrill wrote:
>> On 02/19/2015 07:03 PM, Jakub Jelinek wrote:
>>> +	  /* Avoid warning for !!b == y where b is boolean.  */
>>> +	  && (!DECL_P (current.lhs)
>>> +	      || TREE_TYPE (current.lhs) == NULL_TREE
>>> +	      || TREE_CODE (TREE_TYPE (current.lhs)) != BOOLEAN_TYPE))
>>
>> There's something wrong here.  If the type is null, trying to check its
>> TREE_CODE will SEGV.
>
> If the type is NULL, then it will just call warn_logical_not_parentheses
> and won't check TREE_CODE.  Only when it is non-NULL, it will check
> TREE_CODE and if it is not BOOLEAN_TYPE, will call
> warn_logical_not_parentheses.

You're right, of course.  I guess I was reading the || as an &&.  The 
patch is OK.

Jason


  reply	other threads:[~2015-03-09 16:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20  0:09 Jakub Jelinek
2015-02-20 15:47 ` Marek Polacek
2015-02-20 16:12   ` Jakub Jelinek
2015-02-27 23:23 ` Jason Merrill
2015-03-09 14:35   ` Jakub Jelinek
2015-03-09 16:13     ` Jason Merrill [this message]
2015-04-10 19:40 ` Gerald Pfeifer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54FDC69F.3000901@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).