2019-10-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* gofrontend/ast-dump.cc
	(Ast_dump_traverse_blocks_and_functions::function): Remove shadowing
	local var.
	* gofrontend/escape.cc (Escape_analysis_assign::expression): Likewise.
	* gofrontend/expressions.cc
	(Type_conversion_expression::do_get_backend): Rename local var.
	Add missing free.
	(Bound_method_expression::do_flatten): Rename local var.
	(Builtin_call_expression::lower_make,
	Builtin_call_expression::flatten_append): Remove shadowing local vars.
	(Call_expression::do_lower): Rename local vars.
	(Call_expression::do_get_backend): Remove shadowing local var.
	(Call_expression::lower_array,
	Interface_info_expression::do_type): Rename local var.
	* gofrontend/gogo.cc (Gogo::import_package, Gogo::define_global_names,
	Gogo::recompute_init_priorities): Rename local var.
	(Function::build): Remove shadowing local var.  Rename local var.
	* gofrontend/parse.cc (Parse::parameter_list,
	Parse::composite_lit): Rename local var.
	* gofrontend/statements.cc (Thunk_statement::build_thunk,
	Select_statement::lower_two_case,
	For_range_statement::lower_range_array,
	For_range_statement::lower_range_slice): Remove shadowing local vars.
	(For_range_statement::lower_array_range_clear): Rename local var.
	* gofrontend/types.cc (Struct_type::do_type_descriptor): Remove
	shadowing local vars.
	(Struct_type::do_reflection): Rename local var.
	(Array_type::verify_length): Rename local var.  Add missing mpz_clear.
	(Array_type::do_export): Add missing free.
	(Interface_type::do_import): Rename local var.

Index: gcc/go/gofrontend/ast-dump.cc
===================================================================
--- gcc/go/gofrontend/ast-dump.cc	(revision 276484)
+++ gcc/go/gofrontend/ast-dump.cc	(working copy)
@@ -135,7 +135,7 @@ Ast_dump_traverse_blocks_and_functions::function(N
         {
           if (it != res->begin())
             this->ast_dump_context_->ostream() << ",";
-          Named_object* no = (*it);
+          no = (*it);
 
           this->ast_dump_context_->ostream() << no->name() << " ";
           go_assert(no->is_result_variable());
Index: gcc/go/gofrontend/escape.cc
===================================================================
--- gcc/go/gofrontend/escape.cc	(revision 276484)
+++ gcc/go/gofrontend/escape.cc	(working copy)
@@ -1541,7 +1541,6 @@ Escape_analysis_assign::expression(Expression** pe
 
   if (debug_level > 1)
     {
-      Node* n = Node::make_node(*pexpr);
       std::string fn_name = this->context_->current_function_name();
       go_debug((*pexpr)->location(), "[%d] %s esc: %s",
 	       this->context_->loop_depth(), fn_name.c_str(),
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 276484)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -4104,9 +4104,11 @@ Type_conversion_expression::do_get_backend(Transla
             x = mpz_get_ui(intval);
           else
             {
-              char* s = mpz_get_str(NULL, 16, intval);
+              char* s1 = mpz_get_str(NULL, 16, intval);
               go_warning_at(loc, 0,
-                            "unicode code point 0x%s out of range in string", s);
+                            "unicode code point 0x%s out of range in string",
+                            s1);
+              free(s1);
               x = 0xfffd;
             }
 	  Lex::append_char(x, true, &s, loc);
@@ -8038,13 +8040,13 @@ Bound_method_expression::do_flatten(Gogo* gogo, Na
 
   if (this->method_->is_value_method() && expr->type()->points_to() != NULL)
     {
-      Expression* n = Expression::make_binary(OPERATOR_EQEQ, expr,
-					      Expression::make_nil(loc),
-					      loc);
+      Expression* n1 = Expression::make_binary(OPERATOR_EQEQ, expr,
+					       Expression::make_nil(loc),
+					       loc);
       if (nil_check == NULL)
-	nil_check = n;
+	nil_check = n1;
       else
-	nil_check = Expression::make_binary(OPERATOR_OROR, nil_check, n, loc);
+	nil_check = Expression::make_binary(OPERATOR_OROR, nil_check, n1, loc);
     }
 
   if (nil_check != NULL)
@@ -8741,8 +8743,6 @@ Builtin_call_expression::lower_make(Statement_inse
 				  Expression::make_nil(loc));
       else
 	{
-	  Numeric_constant nclen;
-	  unsigned long vlen;
 	  if (len_arg->numeric_constant_value(&nclen)
 	      && nclen.to_unsigned_long(&vlen) == Numeric_constant::NC_UL_VALID
 	      && vlen <= Map_type::bucket_size)
@@ -9053,8 +9053,7 @@ Builtin_call_expression::flatten_append(Gogo* gogo
           else
             {
               Type* int32_type = Type::lookup_integer_type("int32");
-              Expression* zero =
-                Expression::make_integer_ul(0, int32_type, loc);
+              zero = Expression::make_integer_ul(0, int32_type, loc);
               call = Runtime::make_call(Runtime::BUILTIN_MEMSET, loc, 3, a1,
                                         zero, a2);
             }
@@ -9064,15 +9063,12 @@ Builtin_call_expression::flatten_append(Gogo* gogo
               // For a slice containing pointers, growslice already zeroed
               // the memory. We only need to zero in non-growing case.
               // Note: growslice does not zero the memory in non-pointer case.
-              Expression* left =
-                Expression::make_temporary_reference(ntmp, loc);
+              left = Expression::make_temporary_reference(ntmp, loc);
               left = Expression::make_cast(uint_type, left, loc);
-              Expression* right =
-                Expression::make_temporary_reference(c1tmp, loc);
+              right = Expression::make_temporary_reference(c1tmp, loc);
               right = Expression::make_cast(uint_type, right, loc);
-              Expression* cond =
-                Expression::make_binary(OPERATOR_GT, left, right, loc);
-              Expression* zero = Expression::make_integer_ul(0, int_type, loc);
+              cond = Expression::make_binary(OPERATOR_GT, left, right, loc);
+              zero = Expression::make_integer_ul(0, int_type, loc);
               call = Expression::make_conditional(cond, call, zero, loc);
             }
         }
@@ -10877,9 +10873,9 @@ Call_expression::do_lower(Gogo* gogo, Named_object
   if (this->result_count() > 1 && this->call_temp_ == NULL)
     {
       Struct_field_list* sfl = new Struct_field_list();
-      Function_type* fntype = this->get_function_type();
-      const Typed_identifier_list* results = fntype->results();
-      Location loc = this->location();
+      Function_type* fntype1 = this->get_function_type();
+      const Typed_identifier_list* results = fntype1->results();
+      Location loc0 = this->location();
 
       int i = 0;
       char buf[20];
@@ -10888,12 +10884,12 @@ Call_expression::do_lower(Gogo* gogo, Named_object
            ++p, ++i)
         {
           snprintf(buf, sizeof buf, "res%d", i);
-          sfl->push_back(Struct_field(Typed_identifier(buf, p->type(), loc)));
+          sfl->push_back(Struct_field(Typed_identifier(buf, p->type(), loc0)));
         }
 
-      Struct_type* st = Type::make_struct_type(sfl, loc);
+      Struct_type* st = Type::make_struct_type(sfl, loc0);
       st->set_is_struct_incomparable();
-      this->call_temp_ = Statement::make_temporary(st, NULL, loc);
+      this->call_temp_ = Statement::make_temporary(st, NULL, loc0);
       inserter->insert(this->call_temp_);
     }
 
@@ -12295,7 +12291,6 @@ Call_expression::do_get_backend(Translate_context*
     }
   else
     {
-      Expression* first_arg;
       fn = this->interface_method_function(interface_method, &first_arg,
                                            location);
       fn_args[0] = first_arg->get_backend(context);
@@ -16453,11 +16448,11 @@ Composite_literal_expression::lower_array(Type* ty
       traverse_order = new std::vector<unsigned long>();
       traverse_order->reserve(v.size());
 
-      for (V::const_iterator p = v.begin(); p != v.end(); ++p)
+      for (V::const_iterator p1 = v.begin(); p1 != v.end(); ++p1)
 	{
-	  indexes->push_back(p->index);
-	  vals->push_back(p->expr);
-	  traverse_order->push_back(p->traversal_order);
+	  indexes->push_back(p1->index);
+	  vals->push_back(p1->expr);
+	  traverse_order->push_back(p1->traversal_order);
 	}
     }
 
@@ -17771,9 +17766,9 @@ Interface_info_expression::do_type()
 
         Interface_type* itype = this->iface_->type()->interface_type();
 
-        Hashtable::const_iterator p = result_types.find(itype);
-        if (p != result_types.end())
-          return p->second;
+        Hashtable::const_iterator p1 = result_types.find(itype);
+        if (p1 != result_types.end())
+          return p1->second;
 
         Type* pdt = Type::make_type_descriptor_ptr_type();
         if (itype->is_empty())
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc	(revision 276484)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -518,11 +518,11 @@ Gogo::import_package(const std::string& filename,
       else if (ln == ".")
 	{
 	  Bindings* bindings = package->bindings();
-	  for (Bindings::const_declarations_iterator p =
+	  for (Bindings::const_declarations_iterator p1 =
 		 bindings->begin_declarations();
-	       p != bindings->end_declarations();
-	       ++p)
-	    this->add_dot_import_object(p->second);
+	       p1 != bindings->end_declarations();
+	       ++p1)
+	    this->add_dot_import_object(p1->second);
           std::string dot_alias = "." + package->package_name();
           package->add_alias(dot_alias, location);
 	}
@@ -678,8 +678,8 @@ Gogo::recompute_init_priorities()
            pci != ii->precursors().end();
            ++pci)
         {
-          Import_init* ii = this->lookup_init(*pci);
-          nonroots.insert(ii);
+          Import_init* ii1 = this->lookup_init(*pci);
+          nonroots.insert(ii1);
         }
     }
 
@@ -2613,11 +2613,11 @@ Gogo::define_global_names()
 	    {
 	      if (no->type_declaration_value()->has_methods())
 		{
-		  for (std::vector<Named_object*>::const_iterator p =
+		  for (std::vector<Named_object*>::const_iterator p1 =
 			 no->type_declaration_value()->methods()->begin();
-		       p != no->type_declaration_value()->methods()->end();
-		       p++)
-		    go_error_at((*p)->location(),
+		       p1 != no->type_declaration_value()->methods()->end();
+		       p1++)
+		    go_error_at((*p1)->location(),
 				"may not define methods on non-local type");
 		}
 	      no->set_type_value(global_no->type_value());
@@ -6550,7 +6550,6 @@ Function::build(Gogo* gogo, Named_object* named_fu
 
       // Build the backend representation for all the statements in the
       // function.
-      Translate_context context(gogo, named_function, NULL, NULL);
       Bblock* code_block = this->block_->get_backend(&context);
 
       // Initialize variables if necessary.
@@ -6608,8 +6607,8 @@ Function::build(Gogo* gogo, Named_object* named_fu
   // If we created a descriptor for the function, make sure we emit it.
   if (this->descriptor_ != NULL)
     {
-      Translate_context context(gogo, NULL, NULL, NULL);
-      this->descriptor_->get_backend(&context);
+      Translate_context context1(gogo, NULL, NULL, NULL);
+      this->descriptor_->get_backend(&context1);
     }
 }
 
Index: gcc/go/gofrontend/parse.cc
===================================================================
--- gcc/go/gofrontend/parse.cc	(revision 276484)
+++ gcc/go/gofrontend/parse.cc	(working copy)
@@ -815,7 +815,7 @@ Parse::parameters(Typed_identifier_list** pparams,
 Typed_identifier_list*
 Parse::parameter_list(bool* is_varargs)
 {
-  Location location = this->location();
+  Location location1 = this->location();
   Typed_identifier_list* ret = new Typed_identifier_list();
 
   bool saw_error = false;
@@ -995,7 +995,7 @@ Parse::parameter_list(bool* is_varargs)
     }
   if (mix_error)
     {
-      go_error_at(location, "invalid named/anonymous mix");
+      go_error_at(location1, "invalid named/anonymous mix");
       saw_error = true;
     }
   if (saw_error)
@@ -2808,7 +2808,7 @@ Parse::composite_lit(Type* type, int depth, Locati
 	{
 	  std::string identifier = token->identifier();
 	  bool is_exported = token->is_identifier_exported();
-	  Location location = token->location();
+	  Location location1 = token->location();
 
 	  if (this->advance_token()->is_op(OPERATOR_COLON))
 	    {
@@ -2820,7 +2820,7 @@ Parse::composite_lit(Type* type, int depth, Locati
 	      Gogo* gogo = this->gogo_;
 	      val = this->id_to_expression(gogo->pack_hidden_name(identifier,
 								  is_exported),
-					   location, false);
+					   location1, false);
 	      is_name = true;
 	    }
 	  else
@@ -2827,7 +2827,7 @@ Parse::composite_lit(Type* type, int depth, Locati
 	    {
 	      this->unget_token(Token::make_identifier_token(identifier,
 							     is_exported,
-							     location));
+							     location1));
 	      val = this->expression(PRECEDENCE_NORMAL, false, true, NULL,
 				     NULL);
 	    }
@@ -2923,14 +2923,14 @@ Parse::composite_lit(Type* type, int depth, Locati
 	    go_error_at(this->location(), "expected %<,%> or %<}%>");
 
 	  this->gogo_->mark_locals_used();
-	  int depth = 0;
+	  int depth1 = 0;
 	  while (!token->is_eof()
-		 && (depth > 0 || !token->is_op(OPERATOR_RCURLY)))
+		 && (depth1 > 0 || !token->is_op(OPERATOR_RCURLY)))
 	    {
 	      if (token->is_op(OPERATOR_LCURLY))
-		++depth;
+		++depth1;
 	      else if (token->is_op(OPERATOR_RCURLY))
-		--depth;
+		--depth1;
 	      token = this->advance_token();
 	    }
 	  if (token->is_op(OPERATOR_RCURLY))
Index: gcc/go/gofrontend/statements.cc
===================================================================
--- gcc/go/gofrontend/statements.cc	(revision 276484)
+++ gcc/go/gofrontend/statements.cc	(working copy)
@@ -2938,7 +2938,7 @@ Thunk_statement::build_thunk(Gogo* gogo, const std
       go_assert(call_statement->classification() == STATEMENT_EXPRESSION);
       Expression_statement* es =
 	static_cast<Expression_statement*>(call_statement);
-      Call_expression* ce = es->expr()->call_expression();
+      ce = es->expr()->call_expression();
       if (ce == NULL)
 	go_assert(saw_errors());
       else
@@ -5972,7 +5972,7 @@ Select_statement::lower_two_case(Block* b)
           // if selectnbrecv2(&lhs, &ok, chan) { body } else { default body }
 
           Type* booltype = Type::make_boolean_type();
-          Temporary_statement* ts = Statement::make_temporary(booltype, NULL, loc);
+          ts = Statement::make_temporary(booltype, NULL, loc);
           b->add_statement(ts);
 
           okref = Expression::make_temporary_reference(ts, loc);
@@ -6595,7 +6595,7 @@ For_range_statement::lower_range_array(Gogo* gogo,
       iter_init = new Block(body_block, loc);
 
       ref = Expression::make_temporary_reference(range_temp, loc);
-      Expression* ref2 = Expression::make_temporary_reference(index_temp, loc);
+      ref2 = Expression::make_temporary_reference(index_temp, loc);
       Expression* index = Expression::make_index(ref, ref2, NULL, NULL, loc);
 
       tref = Expression::make_temporary_reference(value_temp, loc);
@@ -6693,7 +6693,7 @@ For_range_statement::lower_range_slice(Gogo* gogo,
       iter_init = new Block(body_block, loc);
 
       ref = Expression::make_temporary_reference(for_temp, loc);
-      Expression* ref2 = Expression::make_temporary_reference(index_temp, loc);
+      ref2 = Expression::make_temporary_reference(index_temp, loc);
       Expression* index = Expression::make_index(ref, ref2, NULL, NULL, loc);
 
       tref = Expression::make_temporary_reference(value_temp, loc);
@@ -7179,9 +7179,9 @@ For_range_statement::lower_array_range_clear(Gogo*
   else
     {
       Type* int32_type = Type::lookup_integer_type("int32");
-      Expression* zero = Expression::make_integer_ul(0, int32_type, loc);
+      Expression* zero1 = Expression::make_integer_ul(0, int32_type, loc);
       call = Runtime::make_call(Runtime::BUILTIN_MEMSET, loc, 3, ptr_arg,
-                                zero, sz_arg);
+                                zero1, sz_arg);
     }
   Statement* cs3 = Statement::make_statement(call, true);
   b->add_statement(cs3);
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 276484)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -6410,12 +6410,11 @@ Struct_type::do_type_descriptor(Gogo* gogo, Named_
         fvals->push_back(Expression::make_nil(bloc));
       else
 	{
-	  std::string n;
           if (is_embedded_builtin)
             n = gogo->package_name();
           else
             n = Gogo::hidden_name_pkgpath(pf->field_name());
-	  Expression* s = Expression::make_string(n, bloc);
+	  s = Expression::make_string(n, bloc);
 	  fvals->push_back(Expression::make_unary(OPERATOR_AND, s, bloc));
 	}
 
@@ -6429,7 +6428,7 @@ Struct_type::do_type_descriptor(Gogo* gogo, Named_
 	fvals->push_back(Expression::make_nil(bloc));
       else
 	{
-	  Expression* s = Expression::make_string(pf->tag(), bloc);
+	  s = Expression::make_string(pf->tag(), bloc);
 	  fvals->push_back(Expression::make_unary(OPERATOR_AND, s, bloc));
 	}
 
@@ -6635,22 +6634,22 @@ Struct_type::do_reflection(Gogo* gogo, std::string
 	{
 	  const std::string& tag(p->tag());
 	  ret->append(" \"");
-	  for (std::string::const_iterator p = tag.begin();
-	       p != tag.end();
-	       ++p)
+	  for (std::string::const_iterator q = tag.begin();
+	       q != tag.end();
+	       ++q)
 	    {
-	      if (*p == '\0')
+	      if (*q == '\0')
 		ret->append("\\x00");
-	      else if (*p == '\n')
+	      else if (*q == '\n')
 		ret->append("\\n");
-	      else if (*p == '\t')
+	      else if (*q == '\t')
 		ret->append("\\t");
-	      else if (*p == '"')
+	      else if (*q == '"')
 		ret->append("\\\"");
-	      else if (*p == '\\')
+	      else if (*q == '\\')
 		ret->append("\\\\");
 	      else
-		ret->push_back(*p);
+		ret->push_back(*q);
 	    }
 	  ret->push_back('"');
 	}
@@ -7197,11 +7196,11 @@ Array_type::verify_length()
       return false;
     case Numeric_constant::NC_UL_BIG:
       {
-	mpz_t val;
-	if (!nc.to_int(&val))
+	mpz_t val1;
+	if (!nc.to_int(&val1))
 	  go_unreachable();
-	unsigned int bits = mpz_sizeinbase(val, 2);
-	mpz_clear(val);
+	unsigned int bits = mpz_sizeinbase(val1, 2);
+	mpz_clear(val1);
 	if (bits >= tbits)
 	  {
 	    go_error_at(this->length_->location(), "array bound overflows");
@@ -7705,6 +7704,7 @@ Array_type::do_export(Export* exp) const
       char* s = mpz_get_str(NULL, 10, val);
       exp->write_string(s);
       exp->write_string(" ");
+      free(s);
       mpz_clear(val);
     }
   exp->write_c_string("] ");
@@ -9730,9 +9730,9 @@ Interface_type::do_import(Import* imp)
   Typed_identifier_list* methods = new Typed_identifier_list;
   while (imp->peek_char() != '}')
     {
-      std::string name = imp->read_identifier();
+      std::string name1 = imp->read_identifier();
 
-      if (name == "?")
+      if (name1 == "?")
 	{
 	  imp->require_c_string(" ");
 	  Type* t = imp->read_type();
@@ -9809,7 +9809,7 @@ Interface_type::do_import(Import* imp)
 						       imp->location());
       if (is_varargs)
 	fntype->set_is_varargs();
-      methods->push_back(Typed_identifier(name, fntype, imp->location()));
+      methods->push_back(Typed_identifier(name1, fntype, imp->location()));
 
       imp->require_c_string("; ");
     }
