Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	(revision 203517)
+++ gcc/tree-vrp.c	(working copy)
@@ -4585,7 +4585,7 @@ dump_asserts_for (FILE *file, tree name)
 	}
       fprintf (file, "\n\tPREDICATE: ");
       print_generic_expr (file, name, 0);
-      fprintf (file, " %s ", tree_code_name[(int)loc->comp_code]);
+      fprintf (file, " %s ", get_tree_code_name (loc->comp_code));
       print_generic_expr (file, loc->val, 0);
       fprintf (file, "\n\n");
       loc = loc->next;
Index: gcc/tree-dump.c
===================================================================
--- gcc/tree-dump.c	(revision 203517)
+++ gcc/tree-dump.c	(working copy)
@@ -278,7 +278,7 @@ dequeue_and_dump (dump_info_p di)
   if (dni->binfo_p)
     code_name = "binfo";
   else
-    code_name = tree_code_name[(int) TREE_CODE (t)];
+    code_name = get_tree_code_name (TREE_CODE (t));
   fprintf (di->stream, "%-16s ", code_name);
   di->column = 25;
 
Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c	(revision 203517)
+++ gcc/tree-pretty-print.c	(working copy)
@@ -59,7 +59,7 @@ do_niy (pretty_printer *buffer, const_tr
   int i, len;
 
   pp_string (buffer, "<<< Unknown tree: ");
-  pp_string (buffer, tree_code_name[(int) TREE_CODE (node)]);
+  pp_string (buffer, get_tree_code_name (TREE_CODE (node)));
 
   if (EXPR_P (node))
     {
@@ -2569,7 +2569,7 @@ dump_generic_node (pretty_printer *buffe
     case VEC_WIDEN_LSHIFT_HI_EXPR:
     case VEC_WIDEN_LSHIFT_LO_EXPR:
       pp_space (buffer);
-      for (str = tree_code_name [code]; *str; str++)
+      for (str = get_tree_code_name (code); *str; str++)
 	pp_character (buffer, TOUPPER (*str));
       pp_string (buffer, " < ");
       dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
Index: gcc/tree-pretty-print.h
===================================================================
--- gcc/tree-pretty-print.h	(revision 203517)
+++ gcc/tree-pretty-print.h	(working copy)
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  
 
 #define pp_unsupported_tree(PP, T)                         \
   pp_verbatim (PP, "#%qs not supported by %s#", \
-               tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
+               get_tree_code_name (TREE_CODE (T)), __FUNCTION__)
 
 #define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data)
 
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 203517)
+++ gcc/tree.c	(working copy)
@@ -91,7 +91,7 @@ const unsigned char tree_code_length[] =
 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
 #define END_OF_BASE_TREE_CODES "@dummy",
 
-const char *const tree_code_name[] = {
+static const char *const tree_code_name[] = {
 #include "all-tree.def"
 };
 
@@ -9098,7 +9098,8 @@ dump_tree_statistics (void)
       fprintf (stderr, "Code                   Nodes\n");
       fprintf (stderr, "----------------------------\n");
       for (i = 0; i < (int) MAX_TREE_CODES; i++)
-	fprintf (stderr, "%-20s %7d\n", tree_code_name[i], tree_code_counts[i]);
+	fprintf (stderr, "%-20s %7d\n", get_tree_code_name ((enum tree_code) i),
+                 tree_code_counts[i]);
       fprintf (stderr, "----------------------------\n");
       ssanames_print_statistics ();
       phinodes_print_statistics ();
@@ -9268,11 +9269,11 @@ tree_check_failed (const_tree node, cons
   va_list args;
   const char *buffer;
   unsigned length = 0;
-  int code;
+  enum tree_code code;
 
   va_start (args, function);
-  while ((code = va_arg (args, int)))
-    length += 4 + strlen (tree_code_name[code]);
+  while ((code = (enum tree_code) va_arg (args, int)))
+    length += 4 + strlen (get_tree_code_name (code));
   va_end (args);
   if (length)
     {
@@ -9281,14 +9282,14 @@ tree_check_failed (const_tree node, cons
       length += strlen ("expected ");
       buffer = tmp = (char *) alloca (length);
       length = 0;
-      while ((code = va_arg (args, int)))
+      while ((code = (enum tree_code) va_arg (args, int)))
 	{
 	  const char *prefix = length ? " or " : "expected ";
 
 	  strcpy (tmp + length, prefix);
 	  length += strlen (prefix);
-	  strcpy (tmp + length, tree_code_name[code]);
-	  length += strlen (tree_code_name[code]);
+	  strcpy (tmp + length, get_tree_code_name (code));
+	  length += strlen (get_tree_code_name (code));
 	}
       va_end (args);
     }
@@ -9296,7 +9297,7 @@ tree_check_failed (const_tree node, cons
     buffer = "unexpected node";
 
   internal_error ("tree check: %s, have %s in %s, at %s:%d",
-		  buffer, tree_code_name[TREE_CODE (node)],
+		  buffer, get_tree_code_name (TREE_CODE (node)),
 		  function, trim_filename (file), line);
 }
 
@@ -9311,29 +9312,29 @@ tree_not_check_failed (const_tree node, 
   va_list args;
   char *buffer;
   unsigned length = 0;
-  int code;
+  enum tree_code code;
 
   va_start (args, function);
-  while ((code = va_arg (args, int)))
-    length += 4 + strlen (tree_code_name[code]);
+  while ((code = (enum tree_code) va_arg (args, int)))
+    length += 4 + strlen (get_tree_code_name (code));
   va_end (args);
   va_start (args, function);
   buffer = (char *) alloca (length);
   length = 0;
-  while ((code = va_arg (args, int)))
+  while ((code = (enum tree_code) va_arg (args, int)))
     {
       if (length)
 	{
 	  strcpy (buffer + length, " or ");
 	  length += 4;
 	}
-      strcpy (buffer + length, tree_code_name[code]);
-      length += strlen (tree_code_name[code]);
+      strcpy (buffer + length, get_tree_code_name (code));
+      length += strlen (get_tree_code_name (code));
     }
   va_end (args);
 
   internal_error ("tree check: expected none of %s, have %s in %s, at %s:%d",
-		  buffer, tree_code_name[TREE_CODE (node)],
+		  buffer, get_tree_code_name (TREE_CODE (node)),
 		  function, trim_filename (file), line);
 }
 
@@ -9348,7 +9349,7 @@ tree_class_check_failed (const_tree node
     ("tree check: expected class %qs, have %qs (%s) in %s, at %s:%d",
      TREE_CODE_CLASS_STRING (cl),
      TREE_CODE_CLASS_STRING (TREE_CODE_CLASS (TREE_CODE (node))),
-     tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
+     get_tree_code_name (TREE_CODE (node)), function, trim_filename (file), line);
 }
 
 /* Similar to tree_check_failed, except that instead of specifying a
@@ -9364,7 +9365,7 @@ tree_range_check_failed (const_tree node
   unsigned int c;
 
   for (c = c1; c <= c2; ++c)
-    length += 4 + strlen (tree_code_name[c]);
+    length += 4 + strlen (get_tree_code_name ((enum tree_code) c));
 
   length += strlen ("expected ");
   buffer = (char *) alloca (length);
@@ -9376,12 +9377,12 @@ tree_range_check_failed (const_tree node
 
       strcpy (buffer + length, prefix);
       length += strlen (prefix);
-      strcpy (buffer + length, tree_code_name[c]);
-      length += strlen (tree_code_name[c]);
+      strcpy (buffer + length, get_tree_code_name ((enum tree_code) c));
+      length += strlen (get_tree_code_name ((enum tree_code) c));
     }
 
   internal_error ("tree check: %s, have %s in %s, at %s:%d",
-		  buffer, tree_code_name[TREE_CODE (node)],
+		  buffer, get_tree_code_name (TREE_CODE (node)),
 		  function, trim_filename (file), line);
 }
 
@@ -9397,7 +9398,7 @@ tree_not_class_check_failed (const_tree 
     ("tree check: did not expect class %qs, have %qs (%s) in %s, at %s:%d",
      TREE_CODE_CLASS_STRING (cl),
      TREE_CODE_CLASS_STRING (TREE_CODE_CLASS (TREE_CODE (node))),
-     tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
+     get_tree_code_name (TREE_CODE (node)), function, trim_filename (file), line);
 }
 
 
@@ -9408,7 +9409,7 @@ omp_clause_check_failed (const_tree node
                          const char *function, enum omp_clause_code code)
 {
   internal_error ("tree check: expected omp_clause %s, have %s in %s, at %s:%d",
-		  omp_clause_code_name[code], tree_code_name[TREE_CODE (node)],
+		  omp_clause_code_name[code], get_tree_code_name (TREE_CODE (node)),
 		  function, trim_filename (file), line);
 }
 
@@ -9469,7 +9470,7 @@ tree_contains_struct_check_failed (const
   internal_error
     ("tree check: expected tree that contains %qs structure, have %qs in %s, at %s:%d",
      TS_ENUM_NAME (en),
-     tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
+     get_tree_code_name (TREE_CODE (node)), function, trim_filename (file), line);
 }
 
 
@@ -9492,10 +9493,10 @@ void
 tree_operand_check_failed (int idx, const_tree exp, const char *file,
 			   int line, const char *function)
 {
-  int code = TREE_CODE (exp);
+  enum tree_code code = TREE_CODE (exp);
   internal_error
     ("tree check: accessed operand %d of %s with %d operands in %s, at %s:%d",
-     idx + 1, tree_code_name[code], TREE_OPERAND_LENGTH (exp),
+     idx + 1, get_tree_code_name (code), TREE_OPERAND_LENGTH (exp),
      function, trim_filename (file), line);
 }
 
@@ -12407,4 +12408,16 @@ using_eh_for_cleanups_p (void)
   return using_eh_for_cleanups_flag;
 }
 
+/* Wrapper for tree_code_name to ensure that tree code is valid */
+const char *
+get_tree_code_name (enum tree_code code)
+{
+  const char *invalid = "<invalid tree code>";
+
+  if (code >= MAX_TREE_CODES)
+    return invalid;
+
+  return tree_code_name[code];
+}
+
 #include "gt-tree.h"
Index: gcc/tree.h
===================================================================
--- gcc/tree.h	(revision 203517)
+++ gcc/tree.h	(working copy)
@@ -4593,6 +4593,8 @@ extern bool block_may_fallthru (const_tr
 extern void using_eh_for_cleanups (void);
 extern bool using_eh_for_cleanups_p (void);
 
+extern const char *get_tree_code_name (enum tree_code);
+
 /* In tree-nested.c */
 extern tree build_addr (tree, tree);
 
Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c	(revision 203517)
+++ gcc/cp/error.c	(working copy)
@@ -2852,7 +2852,7 @@ fndecl_to_string (tree fndecl, int verbo
 static const char *
 code_to_string (enum tree_code c)
 {
-  return tree_code_name [c];
+  return get_tree_code_name (c);
 }
 
 const char *
Index: gcc/cp/cxx-pretty-print.c
===================================================================
--- gcc/cp/cxx-pretty-print.c	(revision 203517)
+++ gcc/cp/cxx-pretty-print.c	(working copy)
@@ -971,7 +971,7 @@ pp_cxx_assignment_operator (cxx_pretty_p
       break;
 
     default:
-      op = tree_code_name[TREE_CODE (t)];
+      op = get_tree_code_name (TREE_CODE (t));
       break;
     }
 
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c	(revision 203517)
+++ gcc/cp/pt.c	(working copy)
@@ -12102,7 +12102,7 @@ tsubst (tree t, tree args, tsubst_flags_
       gcc_unreachable ();
 
     default:
-      sorry ("use of %qs in template", tree_code_name [(int) code]);
+      sorry ("use of %qs in template", get_tree_code_name ((int) code));
       return error_mark_node;
     }
 }
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c	(revision 203517)
+++ gcc/cp/semantics.c	(working copy)
@@ -9656,7 +9656,7 @@ cxx_eval_constant_expression (const cons
 
     default:
       internal_error ("unexpected expression %qE of kind %s", t,
-		      tree_code_name[TREE_CODE (t)]);
+		      get_tree_code_name (TREE_CODE (t)));
       *non_constant_p = true;
       break;
     }
@@ -10417,7 +10417,7 @@ potential_constant_expression_1 (tree t,
       if (objc_is_property_ref (t))
 	return false;
 
-      sorry ("unexpected AST of kind %s", tree_code_name[TREE_CODE (t)]);
+      sorry ("unexpected AST of kind %s", get_tree_code_name (TREE_CODE (t)));
       gcc_unreachable();
       return false;
     }
Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c	(revision 203517)
+++ gcc/cp/mangle.c	(working copy)
@@ -69,7 +69,7 @@ along with GCC; see the file COPYING3.  
   fprintf (stderr, "  %-24s: %-24s\n", (FN), (INPUT))
 # define MANGLE_TRACE_TREE(FN, NODE) \
   fprintf (stderr, "  %-24s: %-24s (%p)\n", \
-	   (FN), tree_code_name[TREE_CODE (NODE)], (void *) (NODE))
+	   (FN), get_tree_code_name (TREE_CODE (NODE)), (void *) (NODE))
 #else
 # define MANGLE_TRACE(FN, INPUT)
 # define MANGLE_TRACE_TREE(FN, NODE)
@@ -329,7 +329,7 @@ dump_substitution_candidates (void)
 	   || CP_TYPE_CONST_P (el)))
 	fprintf (stderr, "CV-");
       fprintf (stderr, "%s (%s at %p)\n",
-	       name, tree_code_name[TREE_CODE (el)], (void *) el);
+	       name, get_tree_code_name (TREE_CODE (el)), (void *) el);
     }
 }
 
@@ -379,13 +379,13 @@ add_substitution (tree node)
 
   if (DEBUG_MANGLE)
     fprintf (stderr, "  ++ add_substitution (%s at %10p)\n",
-	     tree_code_name[TREE_CODE (node)], (void *) node);
+	     get_tree_code_name (TREE_CODE (node)), (void *) node);
 
   /* Get the canonicalized substitution candidate for NODE.  */
   c = canonicalize_for_substitution (node);
   if (DEBUG_MANGLE && c != node)
     fprintf (stderr, "  ++ using candidate (%s at %10p)\n",
-	     tree_code_name[TREE_CODE (node)], (void *) node);
+	     get_tree_code_name (TREE_CODE (node)), (void *) node);
   node = c;
 
 #if ENABLE_CHECKING
@@ -513,7 +513,7 @@ find_substitution (tree node)
 
   if (DEBUG_MANGLE)
     fprintf (stderr, "  ++ find_substitution (%s at %p)\n",
-	     tree_code_name[TREE_CODE (node)], (void *) node);
+	     get_tree_code_name (TREE_CODE (node)), (void *) node);
 
   /* Obtain the canonicalized substitution representation for NODE.
      This is what we'll compare against.  */
Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c	(revision 203517)
+++ gcc/lto-streamer-out.c	(working copy)
@@ -367,7 +367,7 @@ lto_write_tree (struct output_block *ob,
 {
   if (!lto_is_streamable (expr))
     internal_error ("tree code %qs is not supported in LTO streams",
-		    tree_code_name[TREE_CODE (expr)]);
+		    get_tree_code_name (TREE_CODE (expr)));
 
   /* Write the header, containing everything needed to materialize
      EXPR on the reading side.  */
@@ -1241,7 +1241,7 @@ DFS_write_tree (struct output_block *ob,
 		  if (!lto_is_streamable (t))
 		    internal_error ("tree code %qs is not supported "
 				    "in LTO streams",
-				    tree_code_name[TREE_CODE (t)]);
+				    get_tree_code_name (TREE_CODE (t)));
 
 		  gcc_checking_assert (!streamer_handle_as_builtin_p (t));
 
Index: gcc/tree-ssa-dom.c
===================================================================
--- gcc/tree-ssa-dom.c	(revision 203517)
+++ gcc/tree-ssa-dom.c	(working copy)
@@ -639,18 +639,18 @@ print_expr_hash_elt (FILE * stream, cons
         break;
 
       case EXPR_UNARY:
-        fprintf (stream, "%s ", tree_code_name[element->expr.ops.unary.op]);
+        fprintf (stream, "%s ", get_tree_code_name (element->expr.ops.unary.op));
         print_generic_expr (stream, element->expr.ops.unary.opnd, 0);
         break;
 
       case EXPR_BINARY:
         print_generic_expr (stream, element->expr.ops.binary.opnd0, 0);
-        fprintf (stream, " %s ", tree_code_name[element->expr.ops.binary.op]);
+        fprintf (stream, " %s ", get_tree_code_name (element->expr.ops.binary.op));
         print_generic_expr (stream, element->expr.ops.binary.opnd1, 0);
         break;
 
       case EXPR_TERNARY:
-        fprintf (stream, " %s <", tree_code_name[element->expr.ops.ternary.op]);
+        fprintf (stream, " %s <", get_tree_code_name (element->expr.ops.ternary.op));
         print_generic_expr (stream, element->expr.ops.ternary.opnd0, 0);
 	fputs (", ", stream);
         print_generic_expr (stream, element->expr.ops.ternary.opnd1, 0);
Index: gcc/gimple-pretty-print.c
===================================================================
--- gcc/gimple-pretty-print.c	(revision 203517)
+++ gcc/gimple-pretty-print.c	(working copy)
@@ -312,7 +312,7 @@ dump_unary_rhs (pretty_printer *buffer, 
       else
 	{
 	  pp_left_bracket (buffer);
-	  pp_string (buffer, tree_code_name [rhs_code]);
+	  pp_string (buffer, get_tree_code_name (rhs_code));
 	  pp_string (buffer, "] ");
 	}
 
@@ -351,7 +351,7 @@ dump_binary_rhs (pretty_printer *buffer,
     case VEC_PACK_FIX_TRUNC_EXPR:
     case VEC_WIDEN_LSHIFT_HI_EXPR:
     case VEC_WIDEN_LSHIFT_LO_EXPR:
-      for (p = tree_code_name [(int) code]; *p; p++)
+      for (p = get_tree_code_name (code); *p; p++)
 	pp_character (buffer, TOUPPER (*p));
       pp_string (buffer, " <");
       dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
@@ -397,7 +397,7 @@ dump_ternary_rhs (pretty_printer *buffer
     {
     case WIDEN_MULT_PLUS_EXPR:
     case WIDEN_MULT_MINUS_EXPR:
-      for (p = tree_code_name [(int) code]; *p; p++)
+      for (p = get_tree_code_name (code); *p; p++)
 	pp_character (buffer, TOUPPER (*p));
       pp_string (buffer, " <");
       dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
@@ -495,7 +495,7 @@ dump_gimple_assign (pretty_printer *buff
 	}
 
       dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
-                       tree_code_name[gimple_assign_rhs_code (gs)],
+                       get_tree_code_name (gimple_assign_rhs_code (gs)),
                        gimple_assign_lhs (gs), arg1, arg2, arg3);
     }
   else
@@ -790,7 +790,7 @@ dump_gimple_cond (pretty_printer *buffer
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
-                   tree_code_name [gimple_cond_code (gs)],
+                   get_tree_code_name (gimple_cond_code (gs)),
                    gimple_cond_lhs (gs), gimple_cond_rhs (gs),
                    gimple_cond_true_label (gs), gimple_cond_false_label (gs));
   else
@@ -1113,7 +1113,7 @@ dump_gimple_omp_for (pretty_printer *buf
 			 gimple_omp_for_index (gs, i),
 			 gimple_omp_for_initial (gs, i),
 			 gimple_omp_for_final (gs, i),
-			 tree_code_name[gimple_omp_for_cond (gs, i)],
+			 get_tree_code_name (gimple_omp_for_cond (gs, i)),
 			 gimple_omp_for_incr (gs, i));
       dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
 		       gimple_omp_for_pre_body (gs));
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	(revision 203517)
+++ gcc/tree-vect-data-refs.c	(working copy)
@@ -3754,7 +3754,7 @@ vect_create_data_ref_ptr (gimple stmt, t
       tree dr_base_type = TREE_TYPE (DR_BASE_OBJECT (dr));
       dump_printf_loc (MSG_NOTE, vect_location,
                        "create %s-pointer variable to type: ",
-                       tree_code_name[(int) TREE_CODE (aggr_type)]);
+                       get_tree_code_name (TREE_CODE (aggr_type)));
       dump_generic_expr (MSG_NOTE, TDF_SLIM, aggr_type);
       if (TREE_CODE (dr_base_type) == ARRAY_TYPE)
         dump_printf (MSG_NOTE, "  vectorizing an array ref: ");
Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c	(revision 203517)
+++ gcc/tree-ssa-pre.c	(working copy)
@@ -911,7 +911,7 @@ print_pre_expr (FILE *outfile, const pre
       {
 	unsigned int i;
 	vn_nary_op_t nary = PRE_EXPR_NARY (expr);
-	fprintf (outfile, "{%s,", tree_code_name [nary->opcode]);
+	fprintf (outfile, "{%s,", get_tree_code_name (nary->opcode));
 	for (i = 0; i < nary->length; i++)
 	  {
 	    print_generic_expr (outfile, nary->op[i], 0);
@@ -936,7 +936,7 @@ print_pre_expr (FILE *outfile, const pre
 	    if (vro->opcode != SSA_NAME
 		&& TREE_CODE_CLASS (vro->opcode) != tcc_declaration)
 	      {
-		fprintf (outfile, "%s", tree_code_name [vro->opcode]);
+		fprintf (outfile, "%s", get_tree_code_name (vro->opcode));
 		if (vro->op0)
 		  {
 		    fprintf (outfile, "<");
Index: gcc/ipa-prop.c
===================================================================
--- gcc/ipa-prop.c	(revision 203517)
+++ gcc/ipa-prop.c	(working copy)
@@ -248,8 +248,7 @@ ipa_print_node_jump_functions_for_edge (
 	  fprintf (f, "PASS THROUGH: ");
 	  fprintf (f, "%d, op %s",
 		   jump_func->value.pass_through.formal_id,
-		   tree_code_name[(int)
-				  jump_func->value.pass_through.operation]);
+		   get_tree_code_name(jump_func->value.pass_through.operation));
 	  if (jump_func->value.pass_through.operation != NOP_EXPR)
 	    {
 	      fprintf (f, " ");
Index: gcc/print-tree.c
===================================================================
--- gcc/print-tree.c	(revision 203517)
+++ gcc/print-tree.c	(working copy)
@@ -71,7 +71,7 @@ print_node_brief (FILE *file, const char
      name if any.  */
   if (indent > 0)
     fprintf (file, " ");
-  fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
+  fprintf (file, "%s <%s", prefix, get_tree_code_name (TREE_CODE (node)));
   dump_addr (file, " ", node);
 
   if (tclass == tcc_declaration)
@@ -247,7 +247,7 @@ print_node (FILE *file, const char *pref
   indent_to (file, indent);
 
   /* Print the slot this node is in, and its code, and address.  */
-  fprintf (file, "%s <%s", prefix, tree_code_name[(int) code]);
+  fprintf (file, "%s <%s", prefix, get_tree_code_name (code));
   dump_addr (file, " ", node);
 
   /* Print the name, if any.  */
Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 203517)
+++ gcc/gimple.c	(working copy)
@@ -1205,10 +1205,10 @@ gimple_check_failed (const_gimple gs, co
 {
   internal_error ("gimple check: expected %s(%s), have %s(%s) in %s, at %s:%d",
       		  gimple_code_name[code],
-		  tree_code_name[subcode],
+		  get_tree_code_name (subcode),
 		  gimple_code_name[gimple_code (gs)],
 		  gs->gsbase.subcode > 0
-		    ? tree_code_name[gs->gsbase.subcode]
+                    ? get_tree_code_name ((enum tree_code) gs->gsbase.subcode)
 		    : "",
 		  function, trim_filename (file), line);
 }
Index: gcc/tree-core.h
===================================================================
--- gcc/tree-core.h	(revision 203517)
+++ gcc/tree-core.h	(working copy)
@@ -1753,9 +1753,6 @@ extern const char *const tree_code_class
 /* Number of argument-words in each kind of tree-node.  */
 extern const unsigned char tree_code_length[];
 
-/* Names of tree components.  */
-extern const char *const tree_code_name[];
-
 /* Vector of all alias pairs for global symbols.  */
 extern GTY(()) vec<alias_pair, va_gc> *alias_pairs;
 
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c	(revision 203517)
+++ gcc/config/frv/frv.c	(working copy)
@@ -3094,7 +3094,7 @@ frv_init_cumulative_args (CUMULATIVE_ARG
 	{
 	  tree ret_type = TREE_TYPE (fntype);
 	  fprintf (stderr, " return=%s,",
-		   tree_code_name[ (int)TREE_CODE (ret_type) ]);
+		   get_tree_code_name ((int)TREE_CODE (ret_type)));
 	}
 
       if (libname && GET_CODE (libname) == SYMBOL_REF)
Index: gcc/config/mep/mep.c
===================================================================
--- gcc/config/mep/mep.c	(revision 203517)
+++ gcc/config/mep/mep.c	(working copy)
@@ -3962,7 +3962,7 @@ mep_validate_vliw (tree *node, tree name
       static int gave_array_note = 0;
       static const char * given_type = NULL;
  
-      given_type = tree_code_name[TREE_CODE (*node)];
+      given_type = get_tree_code_name (TREE_CODE (*node));
       if (TREE_CODE (*node) == POINTER_TYPE)
  	given_type = "pointers";
       if (TREE_CODE (*node) == ARRAY_TYPE)
Index: gcc/config/iq2000/iq2000.c
===================================================================
--- gcc/config/iq2000/iq2000.c	(revision 203517)
+++ gcc/config/iq2000/iq2000.c	(working copy)
@@ -1104,8 +1104,8 @@ init_cumulative_args (CUMULATIVE_ARGS *c
 	  tree ret_type = TREE_TYPE (fntype);
 
 	  fprintf (stderr, ", fntype code = %s, ret code = %s\n",
-		   tree_code_name[(int)TREE_CODE (fntype)],
-		   tree_code_name[(int)TREE_CODE (ret_type)]);
+		   get_tree_code_name (TREE_CODE (fntype)),
+		   get_tree_code_name (TREE_CODE (ret_type)));
 	}
     }
 
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 203517)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -8334,7 +8334,7 @@ init_cumulative_args (CUMULATIVE_ARGS *c
 	{
 	  tree ret_type = TREE_TYPE (fntype);
 	  fprintf (stderr, " ret code = %s,",
-		   tree_code_name[ (int)TREE_CODE (ret_type) ]);
+		   get_tree_code_name (TREE_CODE (ret_type)));
 	}
 
       if (cum->call_cookie & CALL_LONG)
Index: gcc/lto-streamer.c
===================================================================
--- gcc/lto-streamer.c	(revision 203517)
+++ gcc/lto-streamer.c	(working copy)
@@ -54,7 +54,7 @@ lto_tag_name (enum LTO_tags tag)
     {
       /* For tags representing tree nodes, return the name of the
 	 associated tree code.  */
-      return tree_code_name[lto_tag_to_tree_code (tag)];
+      return get_tree_code_name (lto_tag_to_tree_code (tag));
     }
 
   if (lto_tag_is_gimple_code_p (tag))
@@ -199,7 +199,7 @@ print_lto_report (const char *s)
     if (lto_stats.num_trees[i])
       fprintf (stderr, "[%s] # of '%s' objects read: "
 	       HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
-	       tree_code_name[i], lto_stats.num_trees[i]);
+	       get_tree_code_name ((enum tree_code) i), lto_stats.num_trees[i]);
 
   if (flag_lto)
     {
