public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix variable set but not used warnings in Fortran FE
@ 2009-11-27 10:41 Jakub Jelinek
  2009-11-28  0:49 ` Steve Kargl
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2009-11-27 10:41 UTC (permalink / raw)
  To: gcc-patches, fortran

Hi!

This patch fixes set but not used warnings in the Fortran FE.
Most cases are quite obvious and the patch really doesn't (or at least
should not) change gfortran behavior, though if somebody could look it over to see
whether something else wasn't intended with the unused, just set variables,
I'd appreciate it a lot.
There are still 2 warnings I haven't done anything, that really looks like
the variables were supposed to be used somehow:
gcc/fortran/parse.c:1940:68: warning: variable ‘error_flag’ set but not used
gcc/fortran/parse.c:2105:7: warning: variable ‘error_flag’ set but not used
and one which will need a workaround to avoid that warning
(ATTRIBUTE_UNUSED or something like that):
gcc/fortran/trans-common.c:665:14: warning: variable ‘value’ set but not used
BTW, I'm also unsure about that
re = gfc_simplify_expr (e, 1);
in get_array_index, shouldn't we report failure in that case if
gfc_simplify_expr fails?

Bootstrapped/regtested on x86_64-linux.  Ok for trunk?

2009-11-27  Jakub Jelinek  <jakub@redhat.com>

	* trans-common.c (create_common): Remove unused offset variable.
	* io.c (gfc_match_wait): Remove unused loc variable.
	* trans-openmp.c (gfc_trans_omp_clauses): Remove unused old_clauses
	variable.
	(gfc_trans_omp_do): Remove unused outermost variable.
	* iresolve.c (gfc_resolve_alarm_sub, gfc_resolve_fseek_sub): Remove
	unused status variable.
	* module.c (number_use_names): Remove unused c variable.
	(load_derived_extensions): Remove unused nuse variable.
	* trans-expr.c (gfc_conv_substring): Remove unused var variable.
	* trans-types.c (gfc_get_array_descr_info): Remove unused offset_off
	variable.
	* matchexp.c (match_primary): Remove unused where variable.
	* trans-intrinsic.c (gfc_conv_intrinsic_bound): Remove unused cond2
	variable.
	(gfc_conv_intrinsic_sizeof): Remove unused source variable.
	(gfc_conv_intrinsic_transfer): Remove unused stride variable.
	(gfc_conv_intrinsic_function): Remove unused isym variable.
	* arith.c (gfc_hollerith2real, gfc_hollerith2complex,
	gfc_hollerith2logical): Remove unused len variable.
	* parse.c (parse_derived): Remove unused derived_sym variable.
	* decl.c (variable_decl): Remove unused old_locus variable.
	* resolve.c (check_class_members): Remove unused tbp_sym variable.
	(resolve_ordinary_assign): Remove unused assign_proc variable.
	(resolve_equivalence): Remove unused value_name variable.
	* data.c (get_array_index): Remove unused re variable.
	* trans-array.c (gfc_conv_resolve_dependencies): Remove unused
	aref and temp_dim variables.
	(gfc_conv_loop_setup): Remove unused dim and len variables.
	(gfc_walk_variable_expr): Remove unused head variable.
	* match.c (match_typebound_call): Remove unused var variable.
	* intrinsic.c (gfc_convert_chartype): Remove unused from_ts variable.

--- gcc/fortran/trans-common.c.jj	2009-11-04 08:15:48.000000000 +0100
+++ gcc/fortran/trans-common.c	2009-11-26 17:36:35.000000000 +0100
@@ -1,5 +1,5 @@
 /* Common block and equivalence list handling
-   Copyright (C) 2000, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Canqun Yang <canqun@nudt.edu.cn>
 
@@ -636,7 +636,6 @@ create_common (gfc_common_head *com, seg
   if (is_init)
     {
       tree ctor, tmp;
-      HOST_WIDE_INT offset = 0;
       VEC(constructor_elt,gc) *v = NULL;
 
       if (field != NULL_TREE && field_init != NULL_TREE)
@@ -652,7 +651,6 @@ create_common (gfc_common_head *com, seg
 		    s->sym->attr.pointer || s->sym->attr.allocatable);
 
 		CONSTRUCTOR_APPEND_ELT (v, s->field, tmp);
-		offset = s->offset + s->length;
 	      }
 	  }
 
--- gcc/fortran/io.c.jj	2009-10-13 16:20:04.000000000 +0200
+++ gcc/fortran/io.c	2009-11-26 17:36:35.000000000 +0100
@@ -4060,7 +4060,6 @@ gfc_match_wait (void)
 {
   gfc_wait *wait;
   match m;
-  locus loc;
 
   m = gfc_match_char ('(');
   if (m == MATCH_NO)
@@ -4068,8 +4067,6 @@ gfc_match_wait (void)
 
   wait = XCNEW (gfc_wait);
 
-  loc = gfc_current_locus;
-
   m = match_wait_element (wait);
   if (m == MATCH_ERROR)
     goto cleanup;
--- gcc/fortran/trans-openmp.c.jj	2009-11-25 21:24:06.000000000 +0100
+++ gcc/fortran/trans-openmp.c	2009-11-26 22:52:51.000000000 +0100
@@ -700,7 +700,7 @@ static tree
 gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		       locus where)
 {
-  tree omp_clauses = NULL_TREE, chunk_size, c, old_clauses;
+  tree omp_clauses = NULL_TREE, chunk_size, c;
   int list;
   enum omp_clause_code clause_code;
   gfc_se se;
@@ -759,7 +759,6 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
 	    default:
 	      gcc_unreachable ();
 	    }
-	  old_clauses = omp_clauses;
 	  omp_clauses
 	    = gfc_trans_omp_reduction_list (n, omp_clauses, reduction_code,
 					    where);
@@ -1134,14 +1133,13 @@ gfc_trans_omp_do (gfc_code *code, stmtbl
   stmtblock_t block;
   stmtblock_t body;
   gfc_omp_clauses *clauses = code->ext.omp_clauses;
-  gfc_code *outermost;
   int i, collapse = clauses->collapse;
   tree dovar_init = NULL_TREE;
 
   if (collapse <= 0)
     collapse = 1;
 
-  outermost = code = code->block->next;
+  code = code->block->next;
   gcc_assert (code->op == EXEC_DO);
 
   init = make_tree_vec (collapse);
--- gcc/fortran/iresolve.c.jj	2009-08-19 17:46:04.000000000 +0200
+++ gcc/fortran/iresolve.c	2009-11-26 17:36:35.000000000 +0100
@@ -1,5 +1,5 @@
 /* Intrinsic function resolution.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Andy Vaught & Katherine Holcomb
 
@@ -2573,13 +2573,12 @@ void
 gfc_resolve_alarm_sub (gfc_code *c)
 {
   const char *name;
-  gfc_expr *seconds, *handler, *status;
+  gfc_expr *seconds, *handler;
   gfc_typespec ts;
   gfc_clear_ts (&ts);
 
   seconds = c->ext.actual->expr;
   handler = c->ext.actual->next->expr;
-  status = c->ext.actual->next->next->expr;
   ts.type = BT_INTEGER;
   ts.kind = gfc_c_int_kind;
 
@@ -3261,14 +3260,12 @@ gfc_resolve_fseek_sub (gfc_code *c)
   gfc_expr *unit;
   gfc_expr *offset;
   gfc_expr *whence;
-  gfc_expr *status;
   gfc_typespec ts;
   gfc_clear_ts (&ts);
 
   unit   = c->ext.actual->expr;
   offset = c->ext.actual->next->expr;
   whence = c->ext.actual->next->next->expr;
-  status = c->ext.actual->next->next->next->expr;
 
   if (unit->ts.kind != gfc_c_int_kind)
     {
--- gcc/fortran/module.c.jj	2009-11-18 15:48:51.000000000 +0100
+++ gcc/fortran/module.c	2009-11-26 17:36:35.000000000 +0100
@@ -741,8 +741,7 @@ static int
 number_use_names (const char *name, bool interface)
 {
   int i = 0;
-  const char *c;
-  c = find_use_name_n (name, &i, interface);
+  find_use_name_n (name, &i, interface);
   return i;
 }
 
@@ -3977,7 +3976,7 @@ load_equiv (void)
 static void
 load_derived_extensions (void)
 {
-  int symbol, nuse, j;
+  int symbol, j;
   gfc_symbol *derived;
   gfc_symbol *dt;
   gfc_symtree *st;
@@ -4013,7 +4012,6 @@ load_derived_extensions (void)
 	  mio_internal_string (module);
 
           /* Only use one use name to find the symbol.  */
-	  nuse = number_use_names (name, false);
 	  j = 1;
 	  p = find_use_name_n (name, &j, false);
 	  if (p)
--- gcc/fortran/trans-expr.c.jj	2009-11-23 13:04:28.000000000 +0100
+++ gcc/fortran/trans-expr.c	2009-11-26 17:36:35.000000000 +0100
@@ -356,7 +356,6 @@ gfc_conv_substring (gfc_se * se, gfc_ref
 {
   tree tmp;
   tree type;
-  tree var;
   tree fault;
   gfc_se start;
   gfc_se end;
@@ -365,7 +364,6 @@ gfc_conv_substring (gfc_se * se, gfc_ref
   type = gfc_get_character_type (kind, ref->u.ss.length);
   type = build_pointer_type (type);
 
-  var = NULL_TREE;
   gfc_init_se (&start, se);
   gfc_conv_expr_type (&start, ref->u.ss.start, gfc_charlen_type_node);
   gfc_add_block_to_block (&se->pre, &start.pre);
--- gcc/fortran/trans-types.c.jj	2009-10-02 10:02:00.000000000 +0200
+++ gcc/fortran/trans-types.c	2009-11-26 17:36:35.000000000 +0100
@@ -2490,7 +2490,7 @@ gfc_get_array_descr_info (const_tree typ
   int rank, dim;
   bool indirect = false;
   tree etype, ptype, field, t, base_decl;
-  tree data_off, offset_off, dim_off, dim_size, elem_size;
+  tree data_off, dim_off, dim_size, elem_size;
   tree lower_suboff, upper_suboff, stride_suboff;
 
   if (! GFC_DESCRIPTOR_TYPE_P (type))
@@ -2546,7 +2546,6 @@ gfc_get_array_descr_info (const_tree typ
   field = TYPE_FIELDS (TYPE_MAIN_VARIANT (type));
   data_off = byte_position (field);
   field = TREE_CHAIN (field);
-  offset_off = byte_position (field);
   field = TREE_CHAIN (field);
   field = TREE_CHAIN (field);
   dim_off = byte_position (field);
--- gcc/fortran/matchexp.c.jj	2008-09-05 12:55:53.000000000 +0200
+++ gcc/fortran/matchexp.c	2009-11-26 17:36:35.000000000 +0100
@@ -1,5 +1,5 @@
 /* Expression parser.
-   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Andy Vaught
 
@@ -149,7 +149,6 @@ match_primary (gfc_expr **result)
 {
   match m;
   gfc_expr *e;
-  locus where;
 
   m = gfc_match_literal_constant (result, 0);
   if (m != MATCH_NO)
@@ -164,8 +163,6 @@ match_primary (gfc_expr **result)
     return m;
 
   /* Match an expression in parentheses.  */
-  where = gfc_current_locus;
-
   if (gfc_match_char ('(') != MATCH_YES)
     return MATCH_NO;
 
--- gcc/fortran/trans-intrinsic.c.jj	2009-10-26 14:01:32.000000000 +0100
+++ gcc/fortran/trans-intrinsic.c	2009-11-26 17:36:35.000000000 +0100
@@ -832,7 +832,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, g
   tree type;
   tree bound;
   tree tmp;
-  tree cond, cond1, cond2, cond3, cond4, size;
+  tree cond, cond1, cond3, cond4, size;
   tree ubound;
   tree lbound;
   gfc_se argse;
@@ -970,7 +970,6 @@ gfc_conv_intrinsic_bound (gfc_se * se, g
       tree stride = gfc_conv_descriptor_stride_get (desc, bound);
 
       cond1 = fold_build2 (GE_EXPR, boolean_type_node, ubound, lbound);
-      cond2 = fold_build2 (LE_EXPR, boolean_type_node, ubound, lbound);
 
       cond3 = fold_build2 (GE_EXPR, boolean_type_node, stride,
 			   gfc_index_zero_node);
@@ -4090,7 +4089,6 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, g
   gfc_expr *arg;
   gfc_ss *ss;
   gfc_se argse;
-  tree source;
   tree source_bytes;
   tree type;
   tree tmp;
@@ -4106,7 +4104,6 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, g
   if (ss == gfc_ss_terminator)
     {
       gfc_conv_expr_reference (&argse, arg);
-      source = argse.expr;
 
       type = TREE_TYPE (build_fold_indirect_ref_loc (input_location,
 						 argse.expr));
@@ -4123,7 +4120,6 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, g
       source_bytes = gfc_create_var (gfc_array_index_type, "bytes");
       argse.want_pointer = 0;
       gfc_conv_expr_descriptor (&argse, arg, ss);
-      source = gfc_conv_descriptor_data_get (argse.expr);
       type = gfc_get_element_type (TREE_TYPE (argse.expr));
 
       /* Obtain the argument's word length.  */
@@ -4228,7 +4224,6 @@ gfc_conv_intrinsic_transfer (gfc_se * se
   tree size_bytes;
   tree upper;
   tree lower;
-  tree stride;
   tree stmt;
   gfc_actual_arglist *arg;
   gfc_se argse;
@@ -4332,7 +4327,6 @@ gfc_conv_intrinsic_transfer (gfc_se * se
 	  tree idx;
 	  idx = gfc_rank_cst[n];
 	  gfc_add_modify (&argse.pre, source_bytes, tmp);
-	  stride = gfc_conv_descriptor_stride_get (argse.expr, idx);
 	  lower = gfc_conv_descriptor_lbound_get (argse.expr, idx);
 	  upper = gfc_conv_descriptor_ubound_get (argse.expr, idx);
 	  tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
@@ -5065,13 +5059,10 @@ gfc_conv_intrinsic_loc (gfc_se * se, gfc
 void
 gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
 {
-  gfc_intrinsic_sym *isym;
   const char *name;
   int lib, kind;
   tree fndecl;
 
-  isym = expr->value.function.isym;
-
   name = &expr->value.function.name[2];
 
   if (expr->rank > 0 && !expr->inline_noncopying_intrinsic)
--- gcc/fortran/arith.c.jj	2009-10-13 16:20:04.000000000 +0200
+++ gcc/fortran/arith.c	2009-11-26 17:36:35.000000000 +0100
@@ -1,5 +1,5 @@
 /* Compiler arithmetic
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Andy Vaught
 
@@ -2668,9 +2668,6 @@ gfc_expr *
 gfc_hollerith2real (gfc_expr *src, int kind)
 {
   gfc_expr *result;
-  int len;
-
-  len = src->value.character.length;
 
   result = gfc_get_expr ();
   result->expr_type = EXPR_CONSTANT;
@@ -2692,9 +2689,6 @@ gfc_expr *
 gfc_hollerith2complex (gfc_expr *src, int kind)
 {
   gfc_expr *result;
-  int len;
-
-  len = src->value.character.length;
 
   result = gfc_get_expr ();
   result->expr_type = EXPR_CONSTANT;
@@ -2741,9 +2735,6 @@ gfc_expr *
 gfc_hollerith2logical (gfc_expr *src, int kind)
 {
   gfc_expr *result;
-  int len;
-
-  len = src->value.character.length;
 
   result = gfc_get_expr ();
   result->expr_type = EXPR_CONSTANT;
--- gcc/fortran/parse.c.jj	2009-10-21 18:41:31.000000000 +0200
+++ gcc/fortran/parse.c	2009-11-26 17:36:35.000000000 +0100
@@ -1940,7 +1940,6 @@ parse_derived (void)
   int compiling_type, seen_private, seen_sequence, seen_component, error_flag;
   gfc_statement st;
   gfc_state_data s;
-  gfc_symbol *derived_sym = NULL;
   gfc_symbol *sym;
   gfc_component *c;
 
@@ -2061,8 +2060,6 @@ endType:
   /* need to verify that all fields of the derived type are
    * interoperable with C if the type is declared to be bind(c)
    */
-  derived_sym = gfc_current_block();
-
   sym = gfc_current_block ();
   for (c = sym->components; c; c = c->next)
     {
--- gcc/fortran/decl.c.jj	2009-11-25 10:50:10.000000000 +0100
+++ gcc/fortran/decl.c	2009-11-26 17:36:35.000000000 +0100
@@ -1656,12 +1656,10 @@ variable_decl (int elem)
   match m;
   gfc_try t;
   gfc_symbol *sym;
-  locus old_locus;
 
   initializer = NULL;
   as = NULL;
   cp_as = NULL;
-  old_locus = gfc_current_locus;
 
   /* When we get here, we've just matched a list of attributes and
      maybe a type and a double colon.  The next thing we expect to see
--- gcc/fortran/resolve.c.jj	2009-11-24 09:59:28.000000000 +0100
+++ gcc/fortran/resolve.c	2009-11-26 17:36:35.000000000 +0100
@@ -5125,7 +5125,6 @@ check_members (gfc_symbol *derived)
 static void 
 check_class_members (gfc_symbol *derived)
 {
-  gfc_symbol* tbp_sym;
   gfc_expr *e;
   gfc_symtree *tbp;
   gfc_class_esym_list *etmp;
@@ -5145,8 +5144,6 @@ check_class_members (gfc_symbol *derived
 
   if (tbp->n.tb->is_generic)
     {
-      tbp_sym = NULL;
-
       /* If we have to match a passed class member, force the actual
 	 expression to have the correct type.  */
       if (!tbp->n.tb->nopass)
@@ -5159,8 +5156,6 @@ check_class_members (gfc_symbol *derived
           e->value.compcall.base_object->ts.u.derived = derived;
 	}
     }
-  else
-    tbp_sym = tbp->n.tb->u.specific->n.sym;
 
   e->value.compcall.tbp = tbp->n.tb;
   e->value.compcall.name = tbp->name;
@@ -7613,14 +7608,12 @@ resolve_ordinary_assign (gfc_code *code,
 
   if (gfc_extend_assign (code, ns) == SUCCESS)
     {
-      gfc_symbol* assign_proc;
       gfc_expr** rhsptr;
 
       if (code->op == EXEC_ASSIGN_CALL)
 	{
 	  lhs = code->ext.actual->expr;
 	  rhsptr = &code->ext.actual->next->expr;
-	  assign_proc = code->symtree->n.sym;
 	}
       else
 	{
@@ -7635,7 +7628,6 @@ resolve_ordinary_assign (gfc_code *code,
 
 	  tbp = code->expr1->value.compcall.tbp;
 	  gcc_assert (!tbp->is_generic);
-	  assign_proc = tbp->u.specific->n.sym;
 	}
 
       /* Make a temporary rhs when there is a default initializer
@@ -11693,10 +11685,8 @@ resolve_equivalence (gfc_equiv *eq)
   seq_type eq_type, last_eq_type;
   gfc_typespec *last_ts;
   int object, cnt_protected;
-  const char *value_name;
   const char *msg;
 
-  value_name = NULL;
   last_ts = &eq->expr->symtree->n.sym->ts;
 
   first_sym = eq->expr->symtree->n.sym;
--- gcc/fortran/data.c.jj	2009-08-19 17:46:04.000000000 +0200
+++ gcc/fortran/data.c	2009-11-26 17:36:35.000000000 +0100
@@ -1,5 +1,5 @@
 /* Supporting functions for resolving DATA statement.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Lifang Zeng <zlf605@hotmail.com>
 
@@ -46,7 +46,6 @@ get_array_index (gfc_array_ref *ar, mpz_
 {
   gfc_expr *e;
   int i;
-  gfc_try re;
   mpz_t delta;
   mpz_t tmp;
 
@@ -56,7 +55,7 @@ get_array_index (gfc_array_ref *ar, mpz_
   for (i = 0; i < ar->dimen; i++)
     {
       e = gfc_copy_expr (ar->start[i]);
-      re = gfc_simplify_expr (e, 1);
+      gfc_simplify_expr (e, 1);
 
       if ((gfc_is_constant_expr (ar->as->lower[i]) == 0)
 	  || (gfc_is_constant_expr (ar->as->upper[i]) == 0)
--- gcc/fortran/trans-array.c.jj	2009-10-21 18:41:31.000000000 +0200
+++ gcc/fortran/trans-array.c	2009-11-26 17:36:35.000000000 +0100
@@ -3459,13 +3459,9 @@ gfc_conv_resolve_dependencies (gfc_loopi
   gfc_ss *ss;
   gfc_ref *lref;
   gfc_ref *rref;
-  gfc_ref *aref;
   int nDepend = 0;
-  int temp_dim = 0;
 
   loop->temp_ss = NULL;
-  aref = dest->data.info.ref;
-  temp_dim = 0;
 
   for (ss = rss; ss != gfc_ss_terminator; ss = ss->next)
     {
@@ -3514,7 +3510,6 @@ gfc_conv_resolve_dependencies (gfc_loopi
 		  if (depends[n])
 		  loop->order[dim++] = n;
 		}
-	      temp_dim = dim;
 	      for (n = 0; n < loop->dimen; n++)
 	        {
 		  if (! depends[n])
@@ -3557,12 +3552,10 @@ void
 gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
 {
   int n;
-  int dim;
   gfc_ss_info *info;
   gfc_ss_info *specinfo;
   gfc_ss *ss;
   tree tmp;
-  tree len;
   gfc_ss *loopspec[GFC_MAX_DIMENSIONS];
   bool dynamic[GFC_MAX_DIMENSIONS];
   gfc_constructor *c;
@@ -3743,7 +3736,6 @@ gfc_conv_loop_setup (gfc_loopinfo * loop
 			 loop->temp_ss->string_length);
 
       tmp = loop->temp_ss->data.temp.type;
-      len = loop->temp_ss->string_length;
       n = loop->temp_ss->data.temp.dimen;
       memset (&loop->temp_ss->data.info, 0, sizeof (gfc_ss_info));
       loop->temp_ss->type = GFC_SS_SECTION;
@@ -3775,8 +3767,6 @@ gfc_conv_loop_setup (gfc_loopinfo * loop
 
       for (n = 0; n < info->dimen; n++)
 	{
-	  dim = info->dim[n];
-
 	  /* If we are specifying the range the delta is already set.  */
 	  if (loopspec[n] != ss)
 	    {
@@ -6180,7 +6170,6 @@ gfc_walk_variable_expr (gfc_ss * ss, gfc
   gfc_ref *ref;
   gfc_array_ref *ar;
   gfc_ss *newss;
-  gfc_ss *head;
   int n;
 
   for (ref = expr->ref; ref; ref = ref->next)
@@ -6253,8 +6242,6 @@ gfc_walk_variable_expr (gfc_ss * ss, gfc
 	  newss->data.info.dimen = 0;
 	  newss->data.info.ref = ref;
 
-	  head = newss;
-
           /* We add SS chains for all the subscripts in the section.  */
 	  for (n = 0; n < ar->dimen; n++)
 	    {
--- gcc/fortran/match.c.jj	2009-11-18 15:48:51.000000000 +0100
+++ gcc/fortran/match.c	2009-11-26 17:36:35.000000000 +0100
@@ -1,5 +1,5 @@
 /* Matching subroutines in all sizes, shapes and colors.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Contributed by Andy Vaught
 
@@ -2901,12 +2901,9 @@ done:
 static match
 match_typebound_call (gfc_symtree* varst)
 {
-  gfc_symbol* var;
   gfc_expr* base;
   match m;
 
-  var = varst->n.sym;
-
   base = gfc_get_expr ();
   base->expr_type = EXPR_VARIABLE;
   base->symtree = varst;
--- gcc/fortran/intrinsic.c.jj	2009-10-02 10:02:00.000000000 +0200
+++ gcc/fortran/intrinsic.c	2009-11-26 17:36:35.000000000 +0100
@@ -4054,14 +4054,12 @@ gfc_try
 gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)
 {
   gfc_intrinsic_sym *sym;
-  gfc_typespec from_ts;
   locus old_where;
   gfc_expr *new_expr;
   int rank;
   mpz_t *shape;
 
   gcc_assert (expr->ts.type == BT_CHARACTER && ts->type == BT_CHARACTER);
-  from_ts = expr->ts;		/* expr->ts gets clobbered */
 
   sym = find_char_conv (&expr->ts, ts);
   gcc_assert (sym);

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix variable set but not used warnings in Fortran FE
  2009-11-27 10:41 [PATCH] Fix variable set but not used warnings in Fortran FE Jakub Jelinek
@ 2009-11-28  0:49 ` Steve Kargl
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Kargl @ 2009-11-28  0:49 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, fortran

On Fri, Nov 27, 2009 at 05:36:45AM -0500, Jakub Jelinek wrote:
> 
> This patch fixes set but not used warnings in the Fortran FE.
> Most cases are quite obvious and the patch really doesn't (or at least
> should not) change gfortran behavior, though if somebody could look
> it over to see whether something else wasn't intended with the unused,
> just set variables,  I'd appreciate it a lot.

After reading through the patch and the affected code, it
appears that you're simply doing janitor duty and cleaning
up accumulated junk.  Thanks.

> BTW, I'm also unsure about that
> re = gfc_simplify_expr (e, 1);
> in get_array_index, shouldn't we report failure in that case if
> gfc_simplify_expr fails?

I think get_array_index is only called in situations where
gfc_simplify_expr cannot fail.

> 
> Bootstrapped/regtested on x86_64-linux.  Ok for trunk?
> 

Yes.

-- 
steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-27 23:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-27 10:41 [PATCH] Fix variable set but not used warnings in Fortran FE Jakub Jelinek
2009-11-28  0:49 ` Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).