Commit dcb6e951 by Rafael Avila de Espindola Committed by Rafael Espindola

c-decl.c (merge_decls): Make sure newdecl and olddecl don't share the argument list.

2009-04-02  Rafael Avila de Espindola  <espindola@google.com>

	* c-decl.c (merge_decls): Make sure newdecl and olddecl don't
	share the argument list.

From-SVN: r145456
parent d85478c2
2009-04-02 Rafael Avila de Espindola <espindola@google.com> 2009-04-02 Rafael Avila de Espindola <espindola@google.com>
* c-decl.c (merge_decls): Make sure newdecl and olddecl don't
share the argument list.
2009-04-02 Rafael Avila de Espindola <espindola@google.com>
Merge Merge
2009-02-12 Diego Novillo <dnovillo@google.com> 2009-02-12 Diego Novillo <dnovillo@google.com>
......
...@@ -1853,12 +1853,15 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) ...@@ -1853,12 +1853,15 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
/* Also preserve various other info from the definition. */ /* Also preserve various other info from the definition. */
if (!new_is_definition) if (!new_is_definition)
{ {
tree t;
DECL_RESULT (newdecl) = DECL_RESULT (olddecl); DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl); DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl);
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
gimple_set_body (newdecl, gimple_body (olddecl)); gimple_set_body (newdecl, gimple_body (olddecl));
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); DECL_ARGUMENTS (newdecl) = copy_list (DECL_ARGUMENTS (olddecl));
for (t = DECL_ARGUMENTS (newdecl); t ; t = TREE_CHAIN (t))
DECL_CONTEXT (t) = newdecl;
/* See if we've got a function to instantiate from. */ /* See if we've got a function to instantiate from. */
if (DECL_SAVED_TREE (olddecl)) if (DECL_SAVED_TREE (olddecl))
...@@ -1880,6 +1883,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) ...@@ -1880,6 +1883,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
{ {
unsigned olddecl_uid = DECL_UID (olddecl); unsigned olddecl_uid = DECL_UID (olddecl);
tree olddecl_context = DECL_CONTEXT (olddecl); tree olddecl_context = DECL_CONTEXT (olddecl);
tree olddecl_arguments = NULL;
if (TREE_CODE (olddecl) == FUNCTION_DECL)
olddecl_arguments = DECL_ARGUMENTS (olddecl);
memcpy ((char *) olddecl + sizeof (struct tree_common), memcpy ((char *) olddecl + sizeof (struct tree_common),
(char *) newdecl + sizeof (struct tree_common), (char *) newdecl + sizeof (struct tree_common),
...@@ -1910,6 +1916,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) ...@@ -1910,6 +1916,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
} }
DECL_UID (olddecl) = olddecl_uid; DECL_UID (olddecl) = olddecl_uid;
DECL_CONTEXT (olddecl) = olddecl_context; DECL_CONTEXT (olddecl) = olddecl_context;
if (TREE_CODE (olddecl) == FUNCTION_DECL)
DECL_ARGUMENTS (olddecl) = olddecl_arguments;
} }
/* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl /* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment