optimize.c (remap_decl): Avoid sharing structure for arrays whose size is only known at run-time.

* optimize.c (remap_decl): Avoid sharing structure for arrays
	whose size is only known at run-time.
	* tree.c (copy_tree_r): Don't copy PARM_DECLs.

From-SVN: r33081
This commit is contained in:
Mark Mitchell 2000-04-11 17:29:54 +00:00 committed by Mark Mitchell
parent 454fa7a7db
commit cba6a0b29f
4 changed files with 31 additions and 3 deletions

View File

@ -1,5 +1,9 @@
2000-04-11 Mark Mitchell <mark@codesourcery.com>
* optimize.c (remap_decl): Avoid sharing structure for arrays
whose size is only known at run-time.
* tree.c (copy_tree_r): Don't copy PARM_DECLs.
* cp-tree.h (lang_decl_flags): Rename constructor_for_vbase_attr
to has_in_charge_parm_p.
(DECL_CONSTRUCTOR_FOR_VBASE_P): Rename to ...

View File

@ -109,8 +109,13 @@ remap_decl (decl, id)
walk_tree (&DECL_SIZE_UNIT (t), copy_body_r, id);
if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
&& TYPE_DOMAIN (TREE_TYPE (t)))
{
TREE_TYPE (t) = copy_node (TREE_TYPE (t));
TYPE_DOMAIN (TREE_TYPE (t))
= copy_node (TYPE_DOMAIN (TREE_TYPE (t)));
walk_tree (&TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))),
copy_body_r, id);
}
/* Remember it, so that if we encounter this local entity
again we can reuse this copy. */

View File

@ -1439,7 +1439,6 @@ copy_tree_r (tp, walk_subtrees, data)
|| TREE_CODE_CLASS (code) == 'r'
|| TREE_CODE_CLASS (code) == 'c'
|| TREE_CODE_CLASS (code) == 's'
|| code == PARM_DECL
|| code == TREE_LIST
|| code == TREE_VEC
|| code == OVERLOAD)

View File

@ -0,0 +1,20 @@
// Build don't link:
// Origin: Mark Mitchell <mitchell@codesourcery.com>
// Special g++ Options: -O2
inline void f ()
{
int n;
int i[n];
}
void g ()
{
f ();
}
void h ()
{
f ();
}