This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [FORTRAN PATCH] Quash two -Wlogical-not-parentheses warnings
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Sep 2014 15:28:42 +0200
- Subject: Re: [FORTRAN PATCH] Quash two -Wlogical-not-parentheses warnings
- Authentication-results: sourceware.org; auth=none
- References: <20140901132318 dot GJ2264 at redhat dot com>
On Mon, Sep 1, 2014 at 3:23 PM, Marek Polacek wrote:
> diff --git gcc/fortran/interface.c gcc/fortran/interface.c
> index b210d18..68d8545 100644
> --- gcc/fortran/interface.c
> +++ gcc/fortran/interface.c
> @@ -2014,7 +2014,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
> if (formal->ts.type == BT_CLASS && formal->attr.class_ok
> && actual->expr_type != EXPR_NULL
> && ((CLASS_DATA (formal)->attr.class_pointer
> - && !formal->attr.intent == INTENT_IN)
> + && (!formal->attr.intent) == INTENT_IN)
> || CLASS_DATA (formal)->attr.allocatable))
> {
> if (actual->ts.type != BT_CLASS)
This is certainly not OK, intent is a tri-state.
> diff --git gcc/fortran/trans-expr.c gcc/fortran/trans-expr.c
> index f2ed474..6592c7e 100644
> --- gcc/fortran/trans-expr.c
> +++ gcc/fortran/trans-expr.c
> @@ -4589,7 +4589,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
> && e->expr_type == EXPR_VARIABLE
> && (!e->ref
> || (e->ref->type == REF_ARRAY
> - && !e->ref->u.ar.type != AR_FULL))
> + && (!e->ref->u.ar.type) != AR_FULL))
> && e->symtree->n.sym->attr.optional)
> {
> tmp = fold_build3_loc (input_location, COND_EXPR,
Also not OK.
You probably want to wrap the (in)equality tests in parenthesis.
Ciao!
Steven