aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-10-30 23:32:55 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-10-30 23:32:55 +0000
commitd658cd4c6afb95502cd6a314065498c293e1feb2 (patch)
treeeae3147603fa00ebe355662313326062fe4189c0 /gcc
parent64658ada1f0eb82338866bf81ed0143d95c151c9 (diff)
downloadgcc-d658cd4c6afb95502cd6a314065498c293e1feb2.zip
gcc-d658cd4c6afb95502cd6a314065498c293e1feb2.tar.gz
gcc-d658cd4c6afb95502cd6a314065498c293e1feb2.tar.bz2
decl.c (pop_cp_function_context): Don't call free on a NULL pointer.
* decl.c (pop_cp_function_context): Don't call free on a NULL pointer. * semantics.c: Include ggc.h. (expand_body): Do garbage-collection after processing a template function. Clear DECL_SAVED_TREE after generating RTL for a function. * Makefile.in (semantics.o): Depend on ggc.h. From-SVN: r30279
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/Makefile.in2
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/cp/semantics.c15
4 files changed, 27 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cee60ef..f430d58 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+1999-10-30 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pop_cp_function_context): Don't call free on a NULL
+ pointer.
+ * semantics.c: Include ggc.h.
+ (expand_body): Do garbage-collection after processing a template
+ function. Clear DECL_SAVED_TREE after generating RTL for a
+ function.
+ * Makefile.in (semantics.o): Depend on ggc.h.
+
1999-10-29 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (make_typename_type): Change prototype.
diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in
index d731a58..398703b 100644
--- a/gcc/cp/Makefile.in
+++ b/gcc/cp/Makefile.in
@@ -295,7 +295,7 @@ repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../ggc.h
semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \
$(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
- $(srcdir)/../flags.h
+ $(srcdir)/../flags.h $(srcdir)/../ggc.h
dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
#
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 00b52e4..0f9b5ab 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14234,7 +14234,8 @@ static void
pop_cp_function_context (f)
struct function *f;
{
- free (f->language);
+ if (f->language)
+ free (f->language);
f->language = 0;
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d0a30ba..54dd7e1 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -32,6 +32,7 @@
#include "lex.h"
#include "toplev.h"
#include "flags.h"
+#include "ggc.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
@@ -2509,7 +2510,14 @@ expand_body (fn)
|| (DECL_LANG_SPECIFIC (fn)
&& DECL_TEMPLATE_INFO (fn)
&& uses_template_parms (DECL_TI_ARGS (fn))))
- return;
+ {
+ /* Normally, collection only occurs in rest_of_compilation. So,
+ if we don't collect here, we never collect junk generated
+ during the processing of templates until we hit a
+ non-template function. */
+ ggc_collect ();
+ return;
+ }
/* There's no reason to do any of the work here if we're only doing
semantic analysis; this code just generates RTL. */
@@ -2546,6 +2554,11 @@ expand_body (fn)
/* Generate code for the function. */
finish_function (lineno, 0);
+ /* We don't need the body any more. Allow it to be garbage
+ collected. We can't do this if we're going to dump everything. */
+ if (!flag_dump_translation_unit)
+ DECL_SAVED_TREE (fn) = NULL_TREE;
+
/* And restore the current source position. */
lineno = saved_lineno;
input_filename = saved_input_filename;