tree.c (mark_local_for_remap_p): Mark variables declared in TARGET_EXPRs as well.
* tree.c (mark_local_for_remap_p): Mark variables declared in TARGET_EXPRs as well. From-SVN: r32675
This commit is contained in:
parent
b8de2d021a
commit
ec47ccca04
3 changed files with 62 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2000-03-21 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
* tree.c (mark_local_for_remap_p): Mark variables declared in
|
||||||
|
TARGET_EXPRs as well.
|
||||||
|
|
||||||
2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
|
2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
* typeck.c (require_complete_type, complete_type,
|
* typeck.c (require_complete_type, complete_type,
|
||||||
|
|
|
@ -2317,17 +2317,23 @@ mark_local_for_remap_r (tp, walk_subtrees, data)
|
||||||
{
|
{
|
||||||
tree t = *tp;
|
tree t = *tp;
|
||||||
splay_tree st = (splay_tree) data;
|
splay_tree st = (splay_tree) data;
|
||||||
|
|
||||||
if ((TREE_CODE (t) == DECL_STMT
|
|
||||||
&& nonstatic_local_decl_p (DECL_STMT_DECL (t)))
|
|
||||||
|| TREE_CODE (t) == LABEL_STMT)
|
|
||||||
{
|
|
||||||
tree decl;
|
tree decl;
|
||||||
tree copy;
|
|
||||||
|
|
||||||
/* Figure out what's being declared. */
|
|
||||||
decl = (TREE_CODE (t) == DECL_STMT
|
if (TREE_CODE (t) == DECL_STMT
|
||||||
? DECL_STMT_DECL (t) : LABEL_STMT_LABEL (t));
|
&& nonstatic_local_decl_p (DECL_STMT_DECL (t)))
|
||||||
|
decl = DECL_STMT_DECL (t);
|
||||||
|
else if (TREE_CODE (t) == LABEL_STMT)
|
||||||
|
decl = LABEL_STMT_LABEL (t);
|
||||||
|
else if (TREE_CODE (t) == TARGET_EXPR
|
||||||
|
&& nonstatic_local_decl_p (TREE_OPERAND (t, 0)))
|
||||||
|
decl = TREE_OPERAND (t, 0);
|
||||||
|
else
|
||||||
|
decl = NULL_TREE;
|
||||||
|
|
||||||
|
if (decl)
|
||||||
|
{
|
||||||
|
tree copy;
|
||||||
|
|
||||||
/* Make a copy. */
|
/* Make a copy. */
|
||||||
copy = copy_decl_for_inlining (decl,
|
copy = copy_decl_for_inlining (decl,
|
||||||
|
@ -2344,7 +2350,7 @@ mark_local_for_remap_r (tp, walk_subtrees, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called via walk_tree when an expression is unsaved. Using the
|
/* Called via walk_tree when an expression is unsaved. Using the
|
||||||
splay_tree pointed to by ST (which is really a `splay_tree *'),
|
splay_tree pointed to by ST (which is really a `splay_tree'),
|
||||||
remaps all local declarations to appropriate replacements. */
|
remaps all local declarations to appropriate replacements. */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
|
|
42
gcc/testsuite/g++.old-deja/g++.other/dtor7.C
Normal file
42
gcc/testsuite/g++.old-deja/g++.other/dtor7.C
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Origin: Mark Mitchell <mitchell@codesourcery.com>
|
||||||
|
// Special g++ Options: -O2
|
||||||
|
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
A ();
|
||||||
|
A (const A&);
|
||||||
|
~A ();
|
||||||
|
};
|
||||||
|
|
||||||
|
A::A ()
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
A::A (const A&)
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
A::~A ()
|
||||||
|
{
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
|
||||||
|
A f ()
|
||||||
|
{
|
||||||
|
return A ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void g (const A&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
g (f ());
|
||||||
|
return i;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue