This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[Patch, Fortran, committed] Fix small issues


Found with the Coverity scanner.*

Committed as Rev. 197961 after build+regtesting on x86-64-gnu-linux.

Tobias

* There are more issues, some real, some false positive; thus, if someone wants to reduce the number of true issues ...
2013-04-15  Tobias Burnus  <burnus@net-b.de>

	* class.c (gfc_find_intrinsic_vtab): Removed unused var.
	* dependency.c (check_data_pointer_types): Fix check.
	* frontend-passes.c (check_data_pointer_types): Remove
	superfluous statement.
	* parse.c (decode_omp_directive): Add missing break.
	* resolve.c (resolve_typebound_subroutine: Free variable.
	* trans-decl.c (create_function_arglist): Correct condition.

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index f3fe178..349f494 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -2480,7 +2480,7 @@ gfc_symbol *
 gfc_find_intrinsic_vtab (gfc_typespec *ts)
 {
   gfc_namespace *ns;
-  gfc_symbol *vtab = NULL, *vtype = NULL, *found_sym = NULL, *def_init = NULL;
+  gfc_symbol *vtab = NULL, *vtype = NULL, *found_sym = NULL;
   gfc_symbol *copy = NULL, *src = NULL, *dst = NULL;
   int charlen = 0;
 
@@ -2689,8 +2689,6 @@ cleanup:
       gfc_commit_symbol (vtab);
       if (vtype)
 	gfc_commit_symbol (vtype);
-      if (def_init)
-	gfc_commit_symbol (def_init);
       if (copy)
 	gfc_commit_symbol (copy);
       if (src)
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 6f8e6df..38921b1 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -1200,7 +1200,7 @@ check_data_pointer_types (gfc_expr *expr1, gfc_expr *expr2)
   bool seen_component_ref;
 
   if (expr1->expr_type != EXPR_VARIABLE
-	|| expr1->expr_type != EXPR_VARIABLE)
+	|| expr2->expr_type != EXPR_VARIABLE)
     return false;
 
   sym1 = expr1->symtree->n.sym;
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 9749314..3946c0c 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -1045,8 +1045,6 @@ combine_array_constructor (gfc_expr *e)
   newbase = NULL;
   e->expr_type = EXPR_ARRAY;
 
-  c = gfc_constructor_first (oldbase);
-
   for (c = gfc_constructor_first (oldbase); c;
        c = gfc_constructor_next (c))
     {
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 74a5b4b..8301113 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -621,6 +621,7 @@ decode_omp_directive (void)
       match ("taskyield", gfc_match_omp_taskyield, ST_OMP_TASKYIELD);
       match ("threadprivate", gfc_match_omp_threadprivate,
 	     ST_OMP_THREADPRIVATE);
+      break;
     case 'w':
       match ("workshare", gfc_match_omp_workshare, ST_OMP_WORKSHARE);
       break;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 30cfcd0..418a2d2 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5820,6 +5843,8 @@ resolve_typebound_subroutine (gfc_code *code)
 	correct typespec.  */
       code->expr1->ts = ts;
     }
+  else if (new_ref)
+    gfc_free_ref_list (new_ref);
 
   return true;
 }
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index f2cf2de..b94ffb3 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2146,7 +2146,7 @@ create_function_arglist (gfc_symbol * sym)
 	 hence, the optional status cannot be transfered via a NULL pointer.
 	 Thus, we will use a hidden argument in that case.  */
       else if (f->sym->attr.optional && f->sym->attr.value
-	       && !f->sym->attr.dimension && !f->sym->ts.type != BT_CLASS
+	       && !f->sym->attr.dimension && f->sym->ts.type != BT_CLASS
 	       && f->sym->ts.type != BT_DERIVED)
 	{
           tree tmp;

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