[FORTRAN PATCH] Two -Wlogical-not-parentheses fixes (PR fortran/62270)

Marek Polacek polacek@redhat.com
Tue Sep 2 13:39:00 GMT 2014


(Now for the real fix.)
This patch fixes the last two spots where -Wlogical-not-parentheses
warns.  See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62270#c3
if you want more info about the changes.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-09-02  Marek Polacek  <polacek@redhat.com>

	PR fortran/62270
	* interface.c (compare_parameter): Fix condition.
	* trans-expr.c (gfc_conv_procedure_call): Likewise.

	* gfortran.dg/pointer_intent_7.f90: Adjust dg-error.

diff --git gcc/fortran/interface.c gcc/fortran/interface.c
index b210d18..f6233b7 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)
diff --git gcc/fortran/trans-expr.c gcc/fortran/trans-expr.c
index f2ed474..4c057ee 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,
diff --git gcc/testsuite/gfortran.dg/pointer_intent_7.f90 gcc/testsuite/gfortran.dg/pointer_intent_7.f90
index c09eb2b..5387ace 100644
--- gcc/testsuite/gfortran.dg/pointer_intent_7.f90
+++ gcc/testsuite/gfortran.dg/pointer_intent_7.f90
@@ -23,7 +23,7 @@ contains
     call bar2 (c)
     call bar3 (c)
     call bar2p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
-    call bar3p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
+    call bar3p (b) ! { dg-error "Actual argument to .n. at \\(1\\) must be polymorphic" }
     call bar2p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
     call bar3p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
   end subroutine

	Marek



More information about the Gcc-patches mailing list