[committed,OG9] Fix compiler warnings
diff mbox series

Message ID b45b7a41-c76e-64be-f015-a4ca5c230442@codesourcery.com
State New
Headers show
Series
  • [committed,OG9] Fix compiler warnings
Related show

Commit Message

Tobias Burnus Sept. 18, 2019, 8:26 a.m. UTC
Committed the following patch to silence compiler warnings – some 
pointed to issues, which are now fixed.

Tobias

Patch
diff mbox series

commit 500483e6ced44e2e0fea6a37e4f8c267ebaf826a
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Sep 18 08:44:20 2019 +0200

    Silence compiler warnings
    
    gcc/
    2019-09-17  Tobias Burnus  <tobias@codesourcery.com>
    
            * config/gcn/gcn.c (gcn_expand_scalar_to_vector_address,
            gcn_md_reorg): Remove unused statement.
            (gcn_emutls_var_init): Add missing return - after sorry abort.
            * config/gcn/gcn.md (movdi_symbol_save_scc): Fix condition.
            * config/gcn/mkoffload.c (process_obj): Remove unused variables.
            * gimplify.c (gomp_oacc_needs_data_present): Likewise.
            (gimplify_adjust_omp_clauses): Fix condition by adding ().
            * omp-low.c (process_oacc_gangprivate_1): Comment unused
            parameter name to silence unused warning.
            * omp-sese.c (omp_sese_number, omp_sese_pseudo): Remove
            superfluous ().
            (oacc_do_neutering): Use signed int to avoid a warning.
            * tree-ssa-structalias.c (find_func_aliases_for_builtin_call,
            find_func_clobbers): Use unsigned to silence warning.
    
    gcc/fortran/
    2019-09-17  Tobias Burnus  <tobias@codesourcery.com>
    
            * trans-expr.c (gfc_auto_dereference_var): Use passed loc argument.

diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index 8f3aee75449..fe584959153 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,20 @@ 
+2019-09-17  Tobias Burnus  <tobias@codesourcery.com>
+
+	* config/gcn/gcn.c (gcn_expand_scalar_to_vector_address,
+	gcn_md_reorg): Remove unused statement.
+	(gcn_emutls_var_init): Add missing return - after sorry abort.
+	* config/gcn/gcn.md (movdi_symbol_save_scc): Fix condition.
+	* config/gcn/mkoffload.c (process_obj): Remove unused variables.
+	* gimplify.c (gomp_oacc_needs_data_present): Likewise.
+	(gimplify_adjust_omp_clauses): Fix condition by adding ().
+	* omp-low.c (process_oacc_gangprivate_1): Comment unused
+	parameter name to silence unused warning.
+	* omp-sese.c (omp_sese_number, omp_sese_pseudo): Remove
+	superfluous ().
+	(oacc_do_neutering): Use signed int to avoid a warning.
+	* tree-ssa-structalias.c (find_func_aliases_for_builtin_call,
+	find_func_clobbers): Use unsigned to silence warning.
+
 2019-09-10  Julian Brown  <julian@codesourcery.com>
 
 	* config/gcn/mkoffload.c (process_asm): Remove omp_data_size,
diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index f8434e4a4f1..e0a558b289a 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -1766,7 +1766,6 @@  gcn_expand_scalar_to_vector_address (machine_mode mode, rtx exec, rtx mem,
 	  /* tmp[:] += zext (mem_base)  */
 	  if (exec)
 	    {
-	      rtx undef_di = gcn_gen_undef (DImode);
 	      emit_insn (gen_addv64si3_vcc_dup_exec (tmplo, mem_base_lo, tmplo,
 						     vcc, undef_v64si, exec));
 	      emit_insn (gen_addcv64si3_exec (tmphi, tmphi, const0_rtx,
@@ -3167,6 +3166,7 @@  tree
 gcn_emutls_var_init (tree, tree decl, tree)
 {
   sorry_at (DECL_SOURCE_LOCATION (decl), "TLS is not implemented for GCN.");
+  return NULL_TREE;
 }
 
 /* }}}  */
@@ -4292,8 +4292,6 @@  gcn_md_reorg (void)
 {
   basic_block bb;
   rtx exec_reg = gen_rtx_REG (DImode, EXEC_REG);
-  rtx exec_lo_reg = gen_rtx_REG (SImode, EXEC_LO_REG);
-  rtx exec_hi_reg = gen_rtx_REG (SImode, EXEC_HI_REG);
   regset_head live;
 
   INIT_REG_SET (&live);
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 537bb260ff7..1f328528e4a 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -840,7 +840,7 @@ 
  [(set (match_operand:DI 0 "nonimmediate_operand" "=Sg")
        (match_operand:DI 1 "general_operand" "Y"))
   (clobber (reg:BI CC_SAVE_REG))]
- "GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == LABEL_REF
+ "(GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == LABEL_REF)
   && (lra_in_progress || reload_completed)"
  "#"
  "reload_completed"
diff --git a/gcc/config/gcn/mkoffload.c b/gcc/config/gcn/mkoffload.c
index 593274bf054..c96ed23a2a6 100644
--- a/gcc/config/gcn/mkoffload.c
+++ b/gcc/config/gcn/mkoffload.c
@@ -367,8 +367,6 @@  process_obj (FILE *in, FILE *cfile)
 {
   size_t len = 0;
   const char *input = read_file (in, &len);
-  id_map const *id;
-  unsigned ix;
 
   /* Dump out an array containing the binary.
      FIXME: do this with objcopy.  */
diff --git a/gcc/fortran/ChangeLog.openacc b/gcc/fortran/ChangeLog.openacc
index 576e33fd567..a54fb4e4614 100644
--- a/gcc/fortran/ChangeLog.openacc
+++ b/gcc/fortran/ChangeLog.openacc
@@ -1,3 +1,7 @@ 
+2019-09-17  Tobias Burnus  <tobias@codesourcery.com>
+
+	* trans-expr.c (gfc_auto_dereference_var): Use passed loc argument.
+
 2019-09-06  Andrew Stubbs  <ams@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 7dc5ada9b6b..4a3bd9acd65 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2576,7 +2576,7 @@  gfc_auto_dereference_var (location_t loc, gfc_symbol *sym, tree var,
 	  && (sym->attr.dummy
 	      || sym->attr.function
 	      || sym->attr.result))
-	var = build_fold_indirect_ref_loc (input_location, var);
+	var = build_fold_indirect_ref_loc (loc, var);
     }
   else if (!sym->attr.value)
     {
@@ -2587,7 +2587,7 @@  gfc_auto_dereference_var (location_t loc, gfc_symbol *sym, tree var,
 	  if (!descriptor_only_p)
 	    var = GFC_DECL_SAVED_DESCRIPTOR (var);
 
-	  var = build_fold_indirect_ref_loc (input_location, var);
+	  var = build_fold_indirect_ref_loc (loc, var);
 	}
 
       /* Dereference non-character scalar dummy arguments.  */
@@ -2597,14 +2597,14 @@  gfc_auto_dereference_var (location_t loc, gfc_symbol *sym, tree var,
 	      || (!CLASS_DATA (sym)->attr.dimension
 		  && !(CLASS_DATA (sym)->attr.codimension
 		       && CLASS_DATA (sym)->attr.allocatable))))
-	var = build_fold_indirect_ref_loc (input_location, var);
+	var = build_fold_indirect_ref_loc (loc, var);
 
       /* Dereference scalar hidden result.  */
       if (flag_f2c && sym->ts.type == BT_COMPLEX
 	  && (sym->attr.function || sym->attr.result)
 	  && !sym->attr.dimension && !sym->attr.pointer
 	  && !sym->attr.always_explicit)
-	var = build_fold_indirect_ref_loc (input_location, var);
+	var = build_fold_indirect_ref_loc (loc, var);
 
       /* Dereference non-character, non-class pointer variables.
 	 These must be dummies, results, or scalars.  */
@@ -2617,7 +2617,7 @@  gfc_auto_dereference_var (location_t loc, gfc_symbol *sym, tree var,
 	      || sym->attr.result
 	      || (!sym->attr.dimension
 		  && (!sym->attr.codimension || !sym->attr.allocatable))))
-	var = build_fold_indirect_ref_loc (input_location, var);
+	var = build_fold_indirect_ref_loc (loc, var);
       /* Now treat the class array pointer variables accordingly.  */
       else if (sym->ts.type == BT_CLASS
 	       && sym->attr.dummy
@@ -2627,7 +2627,7 @@  gfc_auto_dereference_var (location_t loc, gfc_symbol *sym, tree var,
 		    && CLASS_DATA (sym)->as->type == AS_ASSUMED_RANK)
 		   || CLASS_DATA (sym)->attr.allocatable
 		   || CLASS_DATA (sym)->attr.class_pointer))
-	var = build_fold_indirect_ref_loc (input_location, var);
+	var = build_fold_indirect_ref_loc (loc, var);
       /* And the case where a non-dummy, non-result, non-function,
 	 non-allotable and non-pointer classarray is present.  This case was
 	 previously covered by the first if, but with introducing the
@@ -2642,7 +2642,7 @@  gfc_auto_dereference_var (location_t loc, gfc_symbol *sym, tree var,
 	       && (sym->assoc
 		   || !CLASS_DATA (sym)->attr.allocatable)
 	       && !CLASS_DATA (sym)->attr.class_pointer)
-	var = build_fold_indirect_ref_loc (input_location, var);
+	var = build_fold_indirect_ref_loc (loc, var);
     }
 
   return var;
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 60761504a5e..d16611d3617 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -9757,7 +9757,6 @@  static oacc_array_mapping_info *
 gomp_oacc_needs_data_present (tree decl)
 {
   gimplify_omp_ctx *ctx = NULL;
-  bool ref_p = TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE;
 
   if (gimplify_omp_ctxp->region_type != ORT_ACC_PARALLEL
       && gimplify_omp_ctxp->region_type != ORT_ACC_KERNELS
@@ -10437,8 +10436,8 @@  gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
 	  /* OpenACC reductions need a present_or_copy data clause.
 	     Add one if necessary.  Emit error when the reduction is
 	     private.  */
-	  if (DECL_P (decl) && ctx->region_type == ORT_ACC_PARALLEL
-	      || ctx->region_type == ORT_ACC_SERIAL)
+	  if (DECL_P (decl) && (ctx->region_type == ORT_ACC_PARALLEL
+				|| ctx->region_type == ORT_ACC_SERIAL))
 	    {
 	      n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
 	      if (n->value & (GOVD_PRIVATE | GOVD_FIRSTPRIVATE))
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 4b21769a9a7..18ad6386f27 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -11204,7 +11204,7 @@  lower_omp_grid_body (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 /* Find gang-private variables in a context.  */
 
 static int
-process_oacc_gangprivate_1 (splay_tree_node node, void *data)
+process_oacc_gangprivate_1 (splay_tree_node node, void * /* data */)
 {
   omp_context *ctx = (omp_context *) node->value;
   unsigned level_total = 0;
diff --git a/gcc/omp-sese.c b/gcc/omp-sese.c
index d6f1e8edd62..d7267017677 100644
--- a/gcc/omp-sese.c
+++ b/gcc/omp-sese.c
@@ -1346,7 +1346,7 @@  oacc_do_neutering (void)
   vec<propagation_set *> prop_set;
   prop_set.create (last_basic_block_for_fn (cfun));
 
-  for (unsigned i = 0; i < last_basic_block_for_fn (cfun); i++)
+  for (int i = 0; i < last_basic_block_for_fn (cfun); i++)
     prop_set.quick_push (0);
 
   find_ssa_names_to_propagate (par, mask, worker_single, vector_single,
@@ -1638,7 +1638,7 @@  omp_sese_number (int n, int p, int dir, basic_block b,
       size_t offset = (dir > 0 ? offsetof (edge_def, dest)
 		       : offsetof (edge_def, src));
       edge e;
-      edge_iterator (ei);
+      edge_iterator ei;
 
       FOR_EACH_EDGE (e, ei, edges)
 	{
@@ -1661,7 +1661,7 @@  omp_sese_pseudo (basic_block me, bb_sese *sese, int depth, int dir,
 		   vec<edge, va_gc> *edges, size_t offset)
 {
   edge e;
-  edge_iterator (ei);
+  edge_iterator ei;
   int hi_back = depth;
   pseudo_node_t node_back (0, depth);
   int hi_child = depth;
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index ebdf31e241e..17f2d3daf12 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4711,7 +4711,7 @@  find_func_aliases_for_builtin_call (struct function *fn, gcall *t)
 		  fnpos = 1;
 		  argpos = 3;
 		  if (targetm.goacc.explode_args ())
-		    for (int i = 6; i < gimple_call_num_args (t); i++)
+		    for (unsigned int i = 6; i < gimple_call_num_args (t); i++)
 		      {
 		        tree arg = gimple_call_arg (t, i);
 			if (TREE_CODE (arg) == INTEGER_CST
@@ -5288,7 +5288,7 @@  find_func_clobbers (struct function *fn, gimple *origt)
 		  implicit_use_args[num_implicit_use_args++] = 4;
 		  implicit_use_args[num_implicit_use_args++] = 5;
 		  if (targetm.goacc.explode_args ())
-		    for (int i = 6; i < gimple_call_num_args (t); i++)
+		    for (unsigned int i = 6; i < gimple_call_num_args (t); i++)
 		      {
 		        tree arg = gimple_call_arg (t, i);
 			if (TREE_CODE (arg) == INTEGER_CST