diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index a80d1a9..ad129c6 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -7010,7 +7010,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
       tree gnu_union_type, gnu_union_name;
       tree this_first_free_pos, gnu_variant_list = NULL_TREE;
       bool union_field_needs_strict_alignment = false;
-      stack_vec <vinfo_t, 16> variant_types;
+      auto_vec <vinfo_t, 16> variant_types;
       vinfo_t *gnu_variant;
       unsigned int variants_align = 0;
       unsigned int i;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5dde632..e3f8b4d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -30809,7 +30809,7 @@ ix86_generate_version_dispatcher_body (void *node_p)
 
   push_cfun (DECL_STRUCT_FUNCTION (resolver_decl));
 
-  stack_vec<tree, 2> fn_ver_vec;
+  auto_vec<tree, 2> fn_ver_vec;
 
   for (versn_info = node_version_info->next; versn_info;
        versn_info = versn_info->next)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7c1b18e..30426d8 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7439,7 +7439,7 @@ build_anon_member_initialization (tree member, tree init,
      to build up the initializer from the outside in so that we can reuse
      previously built CONSTRUCTORs if this is, say, the second field in an
      anonymous struct.  So we use a vec as a stack.  */
-  stack_vec<tree, 2> fields;
+  auto_vec<tree, 2> fields;
   do
     {
       fields.safe_push (TREE_OPERAND (member, 1));
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index eb7e4d4..dcb4566 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -86,10 +86,10 @@ static HARD_REG_SET elim_reg_set;
 
 struct df_collection_rec
 {
-  stack_vec<df_ref, 128> def_vec;
-  stack_vec<df_ref, 32> use_vec;
-  stack_vec<df_ref, 32> eq_use_vec;
-  stack_vec<df_mw_hardreg_ptr, 32> mw_vec;
+  auto_vec<df_ref, 128> def_vec;
+  auto_vec<df_ref, 32> use_vec;
+  auto_vec<df_ref, 32> eq_use_vec;
+  auto_vec<df_mw_hardreg_ptr, 32> mw_vec;
 };
 
 static df_ref df_null_ref_rec[1];
diff --git a/gcc/function.c b/gcc/function.c
index 2c8d781..95f7ed8 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4114,7 +4114,7 @@ reorder_blocks (void)
   if (block == NULL_TREE)
     return;
 
-  stack_vec<tree, 10> block_stack;
+  auto_vec<tree, 10> block_stack;
 
   /* Reset the TREE_ASM_WRITTEN bit for all blocks.  */
   clear_block_marks (block);
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 5580c69..aa05541 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -3349,7 +3349,7 @@ uniq_sort_alt_states (alt_state_t alt_states_list)
   if (alt_states_list->next_alt_state == 0)
     return alt_states_list;
 
-  stack_vec<alt_state_t, 150> alt_states;
+  auto_vec<alt_state_t, 150> alt_states;
   for (curr_alt_state = alt_states_list;
        curr_alt_state != NULL;
        curr_alt_state = curr_alt_state->next_alt_state)
@@ -5484,7 +5484,7 @@ form_ainsn_with_same_reservs (automaton_t automaton)
 {
   ainsn_t curr_ainsn;
   size_t i;
-  stack_vec<ainsn_t, 150> last_insns;
+  auto_vec<ainsn_t, 150> last_insns;
 
   for (curr_ainsn = automaton->ainsn_list;
        curr_ainsn != NULL;
@@ -5555,7 +5555,7 @@ make_automaton (automaton_t automaton)
   state_t state;
   state_t start_state;
   state_t state2;
-  stack_vec<state_t, 150> state_stack;
+  auto_vec<state_t, 150> state_stack;
   int states_n;
   reserv_sets_t reservs_matter = form_reservs_matter (automaton);
 
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2e8c657..d51d1b8 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1846,7 +1846,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 
   /* Create a stack of the subexpressions so later we can walk them in
      order from inner to outer.  */
-  stack_vec<tree, 10> expr_stack;
+  auto_vec<tree, 10> expr_stack;
 
   /* We can handle anything that get_inner_reference can deal with.  */
   for (p = expr_p; ; p = &TREE_OPERAND (*p, 0))
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 038c4f2..2b9e743 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1659,7 +1659,7 @@ debug_generated_program (scop_p scop)
 bool
 gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping)
 {
-  stack_vec<tree, 10> newivs;
+  auto_vec<tree, 10> newivs;
   loop_p context_loop;
   sese region = SCOP_REGION (scop);
   ifsese if_region = NULL;
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index c0d769c..f16cb93 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -593,7 +593,7 @@ loop_is_parallel_p (loop_p loop, bb_pbb_htab_type bb_pbb_mapping, int depth)
   scop_p scop;
 
   timevar_push (TV_GRAPHITE_DATA_DEPS);
-  stack_vec<poly_bb_p, 3> body;
+  auto_vec<poly_bb_p, 3> body;
   scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body);
   dependences = loop_level_carries_dependences (scop, body, depth);
   timevar_pop (TV_GRAPHITE_DATA_DEPS);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a8db98d..00268bb 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -481,7 +481,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
 
     case GBB_LOOP_SING_EXIT_HEADER:
       {
-	stack_vec<sd_region, 3> regions;
+	auto_vec<sd_region, 3> regions;
 	struct scopdet_info sinfo;
 	edge exit_e = single_exit (loop);
 
@@ -546,7 +546,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
       {
         /* XXX: For now we just do not join loops with multiple exits.  If the
            exits lead to the same bb it may be possible to join the loop.  */
-        stack_vec<sd_region, 3> regions;
+        auto_vec<sd_region, 3> regions;
         vec<edge> exits = get_loop_exit_edges (loop);
         edge e;
         int i;
@@ -589,7 +589,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
       }
     case GBB_COND_HEADER:
       {
-	stack_vec<sd_region, 3> regions;
+	auto_vec<sd_region, 3> regions;
 	struct scopdet_info sinfo;
 	vec<basic_block> dominated;
 	int i;
@@ -1192,7 +1192,7 @@ print_graphite_statistics (FILE* file, vec<scop_p> scops)
 static void
 limit_scops (vec<scop_p> *scops)
 {
-  stack_vec<sd_region, 3> regions;
+  auto_vec<sd_region, 3> regions;
 
   int i;
   scop_p scop;
@@ -1404,7 +1404,7 @@ void
 build_scops (vec<scop_p> *scops)
 {
   struct loop *loop = current_loops->tree_root;
-  stack_vec<sd_region, 3> regions;
+  auto_vec<sd_region, 3> regions;
 
   canonicalize_loop_closed_ssa_form ();
   build_scops_1 (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)),
@@ -1595,7 +1595,7 @@ dot_all_scops (vec<scop_p> scops)
 DEBUG_FUNCTION void
 dot_scop (scop_p scop)
 {
-  stack_vec<scop_p, 1> scops;
+  auto_vec<scop_p, 1> scops;
 
   if (scop)
     scops.safe_push (scop);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 0eebbab..dcfafbf 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1245,7 +1245,7 @@ public:
   virtual void after_dom_children (basic_block);
 
 private:
-  stack_vec<gimple, 3> m_conditions, m_cases;
+  auto_vec<gimple, 3> m_conditions, m_cases;
   sese m_region;
 };
 
@@ -1890,7 +1890,7 @@ build_scop_drs (scop_p scop)
   int i, j;
   poly_bb_p pbb;
   data_reference_p dr;
-  stack_vec<data_reference_p, 3> drs;
+  auto_vec<data_reference_p, 3> drs;
 
   /* Remove all the PBBs that do not have data references: these basic
      blocks are not handled in the polyhedral representation.  */
@@ -1988,7 +1988,7 @@ insert_stmts (scop_p scop, gimple stmt, gimple_seq stmts,
 	      gimple_stmt_iterator insert_gsi)
 {
   gimple_stmt_iterator gsi;
-  stack_vec<gimple, 3> x;
+  auto_vec<gimple, 3> x;
 
   gimple_seq_add_stmt (&stmts, stmt);
   for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2007,7 +2007,7 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt)
   gimple_stmt_iterator gsi;
   tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
   gimple stmt = gimple_build_assign (unshare_expr (res), var);
-  stack_vec<gimple, 3> x;
+  auto_vec<gimple, 3> x;
 
   gimple_seq_add_stmt (&stmts, stmt);
   for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2062,7 +2062,7 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr)
   tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
   gimple stmt = gimple_build_assign (unshare_expr (res), var);
   basic_block bb;
-  stack_vec<gimple, 3> x;
+  auto_vec<gimple, 3> x;
 
   gimple_seq_add_stmt (&stmts, stmt);
   for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2870,7 +2870,7 @@ remove_phi (gimple phi)
   tree def;
   use_operand_p use_p;
   gimple_stmt_iterator gsi;
-  stack_vec<gimple, 3> update;
+  auto_vec<gimple, 3> update;
   unsigned int i;
   gimple stmt;
 
@@ -3028,8 +3028,8 @@ rewrite_commutative_reductions_out_of_ssa_close_phi (scop_p scop,
 						     gimple close_phi)
 {
   bool res;
-  stack_vec<gimple, 10> in;
-  stack_vec<gimple, 10> out;
+  auto_vec<gimple, 10> in;
+  auto_vec<gimple, 10> out;
 
   detect_commutative_reduction (scop, close_phi, &in, &out);
   res = in.length () > 1;
diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c
index 77c8149..a246668 100644
--- a/gcc/hw-doloop.c
+++ b/gcc/hw-doloop.c
@@ -252,7 +252,7 @@ discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg)
   loop->head = BRANCH_EDGE (tail_bb)->dest;
   loop->successor = FALLTHRU_EDGE (tail_bb)->dest;
 
-  stack_vec<basic_block, 20> works;
+  auto_vec<basic_block, 20> works;
   works.safe_push (loop->head);
 
   found_tail = false;
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index b2adc3d..ca8374a 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -4531,7 +4531,7 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone)
   calculate_dominance_info (CDI_DOMINATORS);
 
   d = get_cg_data (&node, true);
-  stack_vec<basic_block, 10> queue;
+  auto_vec<basic_block, 10> queue;
   new_irr = BITMAP_ALLOC (&tm_obstack);
 
   /* Scan each tm region, propagating irrevocable status through the tree.  */
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 19402e3..93d45a0 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -727,7 +727,7 @@ shrink_wrap_one_built_in_call (gimple bi_call)
   tree bi_call_label_decl;
   gimple bi_call_label;
 
-  stack_vec<gimple, 12> conds;
+  auto_vec<gimple, 12> conds;
   gen_shrink_wrap_conditions (bi_call, conds, &nconds);
 
   /* This can happen if the condition generator decides
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 09b50d8..6f9b77b 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -4424,7 +4424,7 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
 			      vec<data_reference_p> *datarefs)
 {
   unsigned i;
-  stack_vec<data_ref_loc, 2> references;
+  auto_vec<data_ref_loc, 2> references;
   data_ref_loc *ref;
   bool ret = true;
   data_reference_p dr;
@@ -4454,7 +4454,7 @@ graphite_find_data_references_in_stmt (loop_p nest, loop_p loop, gimple stmt,
 				       vec<data_reference_p> *datarefs)
 {
   unsigned i;
-  stack_vec<data_ref_loc, 2> references;
+  auto_vec<data_ref_loc, 2> references;
   data_ref_loc *ref;
   bool ret = true;
   data_reference_p dr;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 27d6a71..54825d4 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -737,7 +737,7 @@ dump_enumerated_decls (FILE *file, int flags)
 {
   basic_block bb;
   struct walk_stmt_info wi;
-  stack_vec<numbered_tree, 40> decl_list;
+  auto_vec<numbered_tree, 40> decl_list;
 
   memset (&wi, '\0', sizeof (wi));
   wi.info = (void *) &decl_list;
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 7f6a150..cfeb98d 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1208,7 +1208,7 @@ if_convertible_loop_p (struct loop *loop)
 
   refs.create (5);
   ddrs.create (25);
-  stack_vec<loop_p, 3> loop_nest;
+  auto_vec<loop_p, 3> loop_nest;
   res = if_convertible_loop_p_1 (loop, &loop_nest, &refs, &ddrs);
 
   if (flag_tree_loop_if_convert_stores)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index f42ade02..dc97bad 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -5234,7 +5234,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
   unsigned i;
   struct ipa_replace_map *replace_info;
   basic_block old_entry_block, bb;
-  stack_vec<gimple, 10> init_stmts;
+  auto_vec<gimple, 10> init_stmts;
   tree vars = NULL_TREE;
 
   gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index abf69f4..f3906df 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -448,7 +448,7 @@ build_rdg (vec<loop_p> loop_nest, control_dependences *cd)
   vec<data_reference_p> datarefs;
 
   /* Create the RDG vertices from the stmts of the loop nest.  */
-  stack_vec<gimple, 10> stmts;
+  auto_vec<gimple, 10> stmts;
   stmts_from_loop (loop_nest[0], &stmts);
   rdg = new_graph (stmts.length ());
   datarefs.create (10);
@@ -964,7 +964,7 @@ static partition_t
 build_rdg_partition_for_vertex (struct graph *rdg, int v)
 {
   partition_t partition = partition_alloc (NULL, NULL);
-  stack_vec<int, 3> nodes;
+  auto_vec<int, 3> nodes;
   unsigned i;
   int x;
 
@@ -1418,7 +1418,7 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
   int num_sccs = 1;
 
   *nb_calls = 0;
-  stack_vec<loop_p, 3> loop_nest;
+  auto_vec<loop_p, 3> loop_nest;
   if (!find_loop_nest (loop, &loop_nest))
     return 0;
 
@@ -1436,7 +1436,7 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
   if (dump_file && (dump_flags & TDF_DETAILS))
     dump_rdg (dump_file, rdg);
 
-  stack_vec<partition_t, 3> partitions;
+  auto_vec<partition_t, 3> partitions;
   rdg_build_partitions (rdg, stmts, &partitions);
 
   any_builtin = false;
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index a56145d..368a05e 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -424,7 +424,7 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack)
 
   /* Check for problems with dependences.  If the loop can be reversed,
      the iterations are independent.  */
-  stack_vec<loop_p, 3> loop_nest;
+  auto_vec<loop_p, 3> loop_nest;
   datarefs.create (10);
   dependence_relations.create (100);
   if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
@@ -752,7 +752,7 @@ static void
 eliminate_local_variables (edge entry, edge exit)
 {
   basic_block bb;
-  stack_vec<basic_block, 3> body;
+  auto_vec<basic_block, 3> body;
   unsigned i;
   gimple_stmt_iterator gsi;
   bool has_debug_stmt = false;
@@ -1303,7 +1303,7 @@ separate_decls_in_region (edge entry, edge exit,
   tree type, type_name, nvar;
   gimple_stmt_iterator gsi;
   struct clsn_data clsn_data;
-  stack_vec<basic_block, 3> body;
+  auto_vec<basic_block, 3> body;
   basic_block bb;
   basic_block entry_bb = bb1;
   basic_block exit_bb = exit->dest;
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 1d4e439..4479257 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -2395,7 +2395,7 @@ tree_predictive_commoning_loop (struct loop *loop)
 
   /* Find the data references and split them into components according to their
      dependence relations.  */
-  stack_vec<loop_p, 3> loop_nest;
+  auto_vec<loop_p, 3> loop_nest;
   dependences.create (10);
   datarefs.create (10);
   if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index e412d72..0fb4c44 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -768,8 +768,8 @@ aliasing_component_refs_p (tree ref1,
 static bool
 nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2)
 {
-  stack_vec<tree, 16> component_refs1;
-  stack_vec<tree, 16> component_refs2;
+  auto_vec<tree, 16> component_refs1;
+  auto_vec<tree, 16> component_refs2;
 
   /* Create the stack of handled components for REF1.  */
   while (handled_component_p (ref1))
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index fd4ac70..2533971 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1171,7 +1171,7 @@ tree_unroll_loops_completely_1 (bool may_increase_size, bool unroll_outer,
 unsigned int
 tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer)
 {
-  stack_vec<loop_p, 16> father_stack;
+  auto_vec<loop_p, 16> father_stack;
   bool changed;
   int iteration = 0;
   bool irred_invalidated = false;
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 11e565f..891c4d3 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -1715,7 +1715,7 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
     }
 
   /* Find pairs of stores with equal LHS.  */
-  stack_vec<gimple, 1> then_stores, else_stores;
+  auto_vec<gimple, 1> then_stores, else_stores;
   FOR_EACH_VEC_ELT (then_datarefs, i, then_dr)
     {
       if (DR_IS_READ (then_dr))
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index cb6accf..e2eb471 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -690,7 +690,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
       i++;
     }
 
-  stack_vec<tree, alloc_count> fewvars;
+  auto_vec<tree, alloc_count> fewvars;
   pointer_set_t *vars = NULL;
 
   /* If we're already starting with 3/4 of alloc_count, go for a
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 44194b8..1f843ab 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -379,7 +379,7 @@ private:
      leading to this block.  If no such edge equivalency exists, then we
      record NULL.  These equivalences are live until we leave the dominator
      subtree rooted at the block where we record the equivalency.  */
-  stack_vec<tree, 2> m_equiv_stack;
+  auto_vec<tree, 2> m_equiv_stack;
 };
 
 /* Main driver for un-cprop.  */
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index ca8d3a6..3163992 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -612,7 +612,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
 {
   basic_block bb = loop->header;
   tree init, step;
-  stack_vec<gimple, 64> worklist;
+  auto_vec<gimple, 64> worklist;
   gimple_stmt_iterator gsi;
   bool double_reduc;
 
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 7823cc3..d1f8123 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -3213,7 +3213,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
   gimple_stmt_iterator si;
   unsigned int i, j;
   vect_recog_func_ptr vect_recog_func;
-  stack_vec<gimple, 1> stmts_to_replace;
+  auto_vec<gimple, 1> stmts_to_replace;
   gimple stmt;
 
   if (dump_enabled_p ())
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 2387c0d..d1e1796 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2029,7 +2029,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo)
   /* Calculate scalar cost.  */
   FOR_EACH_VEC_ELT (slp_instances, i, instance)
     {
-      stack_vec<bool, 20> life;
+      auto_vec<bool, 20> life;
       life.safe_grow_cleared (SLP_INSTANCE_GROUP_SIZE (instance));
       scalar_cost += vect_bb_slp_scalar_cost (BB_VINFO_BB (bb_vinfo),
 					      SLP_INSTANCE_TREE (instance),
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index ff7b59a..3bae7ec 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -609,7 +609,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
     dump_printf_loc (MSG_NOTE, vect_location,
                      "=== vect_mark_stmts_to_be_vectorized ===\n");
 
-  stack_vec<gimple, 64> worklist;
+  auto_vec<gimple, 64> worklist;
 
   /* 1. Init worklist.  */
   for (i = 0; i < nbbs; i++)
@@ -6129,8 +6129,8 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
 	{
           if (slp_node)
             {
-              stack_vec<tree, 4> ops;
-	      stack_vec<vec<tree>, 4> vec_defs;
+              auto_vec<tree, 4> ops;
+	      auto_vec<vec<tree>, 4> vec_defs;
 
               ops.safe_push (TREE_OPERAND (cond_expr, 0));
               ops.safe_push (TREE_OPERAND (cond_expr, 1));
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 7d4a983..13b877a 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -7930,7 +7930,7 @@ struct expand_loc_callback_data
 
   /* Stack of values and debug_exprs under expansion, and their
      children.  */
-  stack_vec<rtx, 4> expanding;
+  auto_vec<rtx, 4> expanding;
 
   /* Stack of values and debug_exprs whose expansion hit recursion
      cycles.  They will have VALUE_RECURSED_INTO marked when added to
@@ -7938,7 +7938,7 @@ struct expand_loc_callback_data
      resolves to a valid location.  So, if the flag remains set at the
      end of the search, we know no valid location for this one can
      possibly exist.  */
-  stack_vec<rtx, 4> pending;
+  auto_vec<rtx, 4> pending;
 
   /* The maximum depth among the sub-expressions under expansion.
      Zero indicates no expansion so far.  */
@@ -8885,7 +8885,7 @@ process_changed_values (variable_table_type htab)
 {
   int i, n;
   rtx val;
-  stack_vec<rtx, 20> changed_values_stack;
+  auto_vec<rtx, 20> changed_values_stack;
 
   /* Move values from changed_variables to changed_values_stack.  */
   changed_variables
diff --git a/gcc/vec.h b/gcc/vec.h
index 0345585..afde351 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1184,25 +1184,17 @@ public:
 };
 
 
-/* auto_vec is a sub class of vec whose storage is released when it is
-  destroyed. */
-template<typename T>
+/* auto_vec is a subclass of vec that automatically manages creating and
+   releasing the internal vector. If N is non zero then it has N elements of
+   internal storage.  The default is no internal storage, and you probably only
+   want to ask for internal storage for vectors on the stack because if the
+   size of the vector is larger than the internal storage that space is wasted.
+   */
+template<typename T, size_t N = 0>
 class auto_vec : public vec<T, va_heap>
 {
 public:
-  auto_vec () { this->m_vec = NULL; }
-  auto_vec (size_t n) { this->create (n); }
-  ~auto_vec () { this->release (); }
-};
-
-/* stack_vec is a subclass of vec containing N elements of internal storage.
-  You probably only want to allocate this on the stack because if the array
-  ends up being larger or much smaller than N it will be wasting space. */
-template<typename T, size_t N>
-class stack_vec : public vec<T, va_heap>
-{
-public:
-  stack_vec ()
+  auto_vec ()
   {
     m_header.m_alloc = N;
     m_header.m_has_auto_buf = 1;
@@ -1210,7 +1202,7 @@ public:
     this->m_vec = reinterpret_cast<vec<T, va_heap, vl_embed> *> (&m_header);
   }
 
-  ~stack_vec ()
+  ~auto_vec ()
   {
     this->release ();
   }
@@ -1222,6 +1214,17 @@ private:
   T m_data[N];
 };
 
+/* auto_vec is a sub class of vec whose storage is released when it is
+  destroyed. */
+template<typename T>
+class auto_vec<T, 0> : public vec<T, va_heap>
+{
+public:
+  auto_vec () { this->m_vec = NULL; }
+  auto_vec (size_t n) { this->create (n); }
+  ~auto_vec () { this->release (); }
+};
+
 
 /* Allocate heap memory for pointer V and create the internal vector
    with space for NELEMS elements.  If NELEMS is 0, the internal
@@ -1421,7 +1424,7 @@ vec<T, va_heap, vl_ptr>::release (void)
 
   if (using_auto_storage ())
     {
-      static_cast<stack_vec<T, 1> *> (this)->m_header.m_num = 0;
+      static_cast<auto_vec<T, 1> *> (this)->m_header.m_num = 0;
       return;
     }
 
@@ -1654,7 +1657,7 @@ vec<T, va_heap, vl_ptr>::using_auto_storage () const
     return false;
 
   const vec_prefix *auto_header
-    = &static_cast<const stack_vec<T, 1> *> (this)->m_header;
+    = &static_cast<const auto_vec<T, 1> *> (this)->m_header;
   return reinterpret_cast<vec_prefix *> (m_vec) == auto_header;
 }
 
