aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-04-23 15:18:24 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-04-23 15:18:24 +0000
commit8fd8a06f0ed4378f8d5cc97994c7bf0e6e397461 (patch)
tree5ec1007b1ca5d5e7b8f372a864fc8bf9ee71998d /gcc/tree-inline.c
parent77620011625366249ad9e55eefbdd36cc46392eb (diff)
downloadgcc-8fd8a06f0ed4378f8d5cc97994c7bf0e6e397461.zip
gcc-8fd8a06f0ed4378f8d5cc97994c7bf0e6e397461.tar.gz
gcc-8fd8a06f0ed4378f8d5cc97994c7bf0e6e397461.tar.bz2
re PR lto/43455 (ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto)
2010-04-23 Richard Guenther <rguenther@suse.de> PR lto/43455 * tree-inline.c (tree_can_inline_p): Also check compatibility of return types. * gcc.dg/lto/20100423-1_0.c: New testcase. * gcc.dg/lto/20100423-1_1.c: Likewise. From-SVN: r158669
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 1d3008b..59661a7 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -5082,7 +5082,7 @@ tree_can_inline_p (struct cgraph_edge *e)
return false;
}
#endif
- tree caller, callee;
+ tree caller, callee, lhs;
caller = e->caller->decl;
callee = e->callee->decl;
@@ -5108,8 +5108,16 @@ tree_can_inline_p (struct cgraph_edge *e)
return false;
}
+ /* Do not inline calls where we cannot triviall work around mismatches
+ in argument or return types. */
if (e->call_stmt
- && !gimple_check_call_args (e->call_stmt))
+ && ((DECL_RESULT (callee)
+ && !DECL_BY_REFERENCE (DECL_RESULT (callee))
+ && (lhs = gimple_call_lhs (e->call_stmt)) != NULL_TREE
+ && !useless_type_conversion_p (TREE_TYPE (DECL_RESULT (callee)),
+ TREE_TYPE (lhs))
+ && !fold_convertible_p (TREE_TYPE (DECL_RESULT (callee)), lhs))
+ || !gimple_check_call_args (e->call_stmt)))
{
e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
gimple_call_set_cannot_inline (e->call_stmt, true);