This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)


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.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]