aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2011-01-14 12:59:07 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2011-01-14 12:59:07 +0100
commitdb09f9434d83e144068149a34fe3b24b5d5a5d61 (patch)
tree577f6593f3c09144f1ebc7d3eb66927d308579ae
parent642d287307adc8e93432ccf75b8e4a12d12e425f (diff)
downloadgcc-db09f9434d83e144068149a34fe3b24b5d5a5d61.zip
gcc-db09f9434d83e144068149a34fe3b24b5d5a5d61.tar.gz
gcc-db09f9434d83e144068149a34fe3b24b5d5a5d61.tar.bz2
re PR middle-end/46823 (ICE: edge points to wrong declaration)
2011-01-14 Martin Jambor <mjambor@suse.cz> PR middle-end/46823 * tree-inline.c (expand_call_inline): Get fndecl from call graph edge. From-SVN: r168778
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-inline.c22
2 files changed, 15 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 417509a..2ad6e8b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-14 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/46823
+ * tree-inline.c (expand_call_inline): Get fndecl from call graph edge.
+
2011-01-13 Anatoly Sokolov <aesok@post.ru>
* config/xtensa/xtensa.h (XTENSA_LIBCALL_VALUE, LIBCALL_VALUE,
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 6c76fe3..a73cb39 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3783,14 +3783,19 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
if (gimple_code (stmt) != GIMPLE_CALL)
goto egress;
+ /* Objective C and fortran still calls tree_rest_of_compilation directly.
+ Kill this check once this is fixed. */
+ if (!id->dst_node->analyzed)
+ goto egress;
+
+ cg_edge = cgraph_edge (id->dst_node, stmt);
+ gcc_checking_assert (cg_edge);
/* First, see if we can figure out what function is being called.
If we cannot, then there is no hope of inlining the function. */
- fn = gimple_call_fndecl (stmt);
- if (!fn)
+ if (cg_edge->indirect_unknown_callee)
goto egress;
-
- /* Turn forward declarations into real ones. */
- fn = cgraph_node (fn)->decl;
+ fn = cg_edge->callee->decl;
+ gcc_checking_assert (fn);
/* If FN is a declaration of a function in a nested scope that was
globally declared inline, we don't set its DECL_INITIAL.
@@ -3804,13 +3809,6 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
&& gimple_has_body_p (DECL_ABSTRACT_ORIGIN (fn)))
fn = DECL_ABSTRACT_ORIGIN (fn);
- /* Objective C and fortran still calls tree_rest_of_compilation directly.
- Kill this check once this is fixed. */
- if (!id->dst_node->analyzed)
- goto egress;
-
- cg_edge = cgraph_edge (id->dst_node, stmt);
-
/* First check that inlining isn't simply forbidden in this case. */
if (inline_forbidden_into_p (cg_edge->caller->decl, cg_edge->callee->decl))
goto egress;