From cba6a0b29f3a543c4249edd018cdda26ec2c7cf1 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 11 Apr 2000 17:29:54 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/optimize.c | 9 +++++++-- gcc/cp/tree.c | 1 - .../g++.old-deja/g++.other/inline9.C | 20 +++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/inline9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 95077ca7b47..c3b2d4795f2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2000-04-11 Mark Mitchell + * 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 ... diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 63ec81a26ab..b12a2ff6362 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -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))) - walk_tree (&TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))), - copy_body_r, id); + { + 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. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 77973d6d59d..fe175f0a3ed 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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) diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline9.C b/gcc/testsuite/g++.old-deja/g++.other/inline9.C new file mode 100644 index 00000000000..9256c5f9da5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/inline9.C @@ -0,0 +1,20 @@ +// Build don't link: +// Origin: Mark Mitchell +// Special g++ Options: -O2 + +inline void f () +{ + int n; + int i[n]; +} + +void g () +{ + f (); +} + +void h () +{ + f (); +} +