This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54332] [4.8 Regression] 481.wrf in SPEC CPU 2006 takes > 10GB memory to compile
- From: "dnovillo at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 21 Aug 2012 19:50:12 +0000
- Subject: [Bug fortran/54332] [4.8 Regression] 481.wrf in SPEC CPU 2006 takes > 10GB memory to compile
- Auto-submitted: auto-generated
- References: <bug-54332-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54332
--- Comment #23 from dnovillo at google dot com <dnovillo at google dot com> 2012-08-21 19:50:12 UTC ---
On 2012-08-21 15:27 , hjl.tools at gmail dot com wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54332
>
> --- Comment #22 from H.J. Lu <hjl.tools at gmail dot com> 2012-08-21 19:27:50 UTC ---
> This seems to work:
>
> diff --git a/gcc/df-scan.c b/gcc/df-scan.c
> index 35100d1..39f444f 100644
> --- a/gcc/df-scan.c
> +++ b/gcc/df-scan.c
> @@ -4392,6 +4392,7 @@ df_bb_verify (basic_block bb)
> if (!INSN_P (insn))
> continue;
> df_insn_refs_verify (&collection_rec, bb, insn, true);
> + df_free_collection_rec (&collection_rec);
> }
>
> /* Do the artificial defs and uses. */
> diff --git a/gcc/vec.h b/gcc/vec.h
> index cc7e819..3a298ff 100644
> --- a/gcc/vec.h
> +++ b/gcc/vec.h
> @@ -1031,21 +1031,9 @@ vec_reserve (vec_t<T> *vec_, int reserve MEM_STAT_DECL)
> sizeof (T), false
> PASS_MEM_STAT);
> else
> - {
> - /* Only allow stack vectors when re-growing them. The initial
> - allocation of stack vectors must be done with the
> - VEC_stack_alloc macro, because it uses alloca() for the
> - allocation. */
> - if (vec_ == NULL)
> - {
> - fprintf (stderr, "Stack vectors must be initially allocated "
> - "with VEC_stack_alloc.\n");
> - gcc_unreachable ();
> - }
> - return (vec_t<T> *) vec_stack_o_reserve (vec_, reserve,
> - offsetof (vec_t<T>, vec),
> - sizeof (T) PASS_MEM_STAT);
> - }
> + return (vec_t<T> *) vec_stack_o_reserve (vec_, reserve,
> + offsetof (vec_t<T>, vec),
> + sizeof (T) PASS_MEM_STAT);
> }
>
The problem with this is that you are switching a stack vec into a heap
vec. This may not always be what the caller wanted.
The other alternative is to truncate the vectors after the call to
df_insn_refs_verify().