From 23700f650874c9406df42967f0ede7c3f203dc82 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Tue, 4 Dec 2001 10:34:40 +0000 Subject: [PATCH] c-decl.c (duplicate_decls): Revert rth's patch. * c-decl.c (duplicate_decls): Revert rth's patch. If newdecl is in a different binding level, get its abstract origin to be olddecl. * tree-inline.c (expand_call_inline): Move DECL_INITIAL sanity check earlier. * tree.c (get_callee_fndecl): Follow DECL_ABSTRACT_ORIGIN if DECL_INITIAL is NULL. From-SVN: r47610 --- gcc/ChangeLog | 8 ++++++++ gcc/c-decl.c | 11 ++++++----- gcc/tree-inline.c | 7 ++++--- gcc/tree.c | 9 ++++++++- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2787144318..26bed221d40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2001-12-04 Alexandre Oliva + * c-decl.c (duplicate_decls): Revert rth's patch. If newdecl + is in a different binding level, get its abstract origin to be + olddecl. + * tree-inline.c (expand_call_inline): Move DECL_INITIAL sanity + check earlier. + * tree.c (get_callee_fndecl): Follow DECL_ABSTRACT_ORIGIN if + DECL_INITIAL is NULL. + * stmt.c (expand_expr_stmt): Keep last_expr_value non-NULL iff we're interested in the result. Use it to tell whether to ignore results of enclosed expressions. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 654e18438b8..34278546d97 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2019,14 +2019,15 @@ duplicate_decls (newdecl, olddecl, different_binding_level) DECL_INITIAL, so that we don't accidentally change function declarations into function definitions. */ if (! different_binding_level) - { - DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); - DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); - } + DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl); + DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); if (DECL_INLINE (newdecl)) - DECL_ABSTRACT_ORIGIN (newdecl) = DECL_ABSTRACT_ORIGIN (olddecl); + DECL_ABSTRACT_ORIGIN (newdecl) + = (different_binding_level + ? DECL_ORIGIN (olddecl) + : DECL_ABSTRACT_ORIGIN (olddecl)); } } if (different_binding_level) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3adbf345d7f..f82c8c90ae5 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -864,6 +864,10 @@ expand_call_inline (tp, walk_subtrees, data) id->ret_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); DECL_CONTEXT (id->ret_label) = VARRAY_TREE (id->fns, 0); + if (! DECL_INITIAL (fn) + || TREE_CODE (DECL_INITIAL (fn)) != BLOCK) + abort (); + /* Create a block to put the parameters in. We have to do this after the parameters have been remapped because remapping parameters is different from remapping ordinary variables. */ @@ -894,9 +898,6 @@ expand_call_inline (tp, walk_subtrees, data) /* Close the block for the parameters. */ scope_stmt = build_stmt (SCOPE_STMT, DECL_INITIAL (fn)); SCOPE_NO_CLEANUPS_P (scope_stmt) = 1; - if (! DECL_INITIAL (fn) - || TREE_CODE (DECL_INITIAL (fn)) != BLOCK) - abort (); remap_block (scope_stmt, NULL_TREE, id); STMT_EXPR_STMT (expr) = chainon (STMT_EXPR_STMT (expr), scope_stmt); diff --git a/gcc/tree.c b/gcc/tree.c index 3cc52c03f5f..87dac2d5eb5 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4378,7 +4378,14 @@ get_callee_fndecl (call) that `f' is being called. */ if (TREE_CODE (addr) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL) - return TREE_OPERAND (addr, 0); + { + addr = TREE_OPERAND (addr, 0); + + if (! DECL_INITIAL (addr) && DECL_ABSTRACT_ORIGIN (addr)) + addr = DECL_ABSTRACT_ORIGIN (addr); + + return addr; + } /* We couldn't figure out what was being called. */ return NULL_TREE; -- 2.30.2