aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-11-08 13:15:40 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-11-08 13:15:40 +0000
commite7399b548c866ee2e408e0855b3be794c056fb1d (patch)
tree5e723a890f35d1b88c4a982785749464f8f68943
parent03a05fd35a901a3104a7b54913aef7a357f84a2f (diff)
downloadgcc-e7399b548c866ee2e408e0855b3be794c056fb1d.zip
gcc-e7399b548c866ee2e408e0855b3be794c056fb1d.tar.gz
gcc-e7399b548c866ee2e408e0855b3be794c056fb1d.tar.bz2
re PR ipa/92409 (r277920 causes ICE in gcc.dg/cast-function-1.c)
2019-11-08 Richard Biener <rguenther@suse.de> PR ipa/92409 * tree-inline.c (declare_return_variable): Properly handle type mismatches for the return slot. From-SVN: r277972
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-inline.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a2f30cf..89bb204 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-11-08 Richard Biener <rguenther@suse.de>
+
+ PR ipa/92409
+ * tree-inline.c (declare_return_variable): Properly handle
+ type mismatches for the return slot.
+
2019-11-08 Eric Botcazou <ebotcazou@adacore.com>
PR target/92095
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 9d0acd9..63274f7 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3593,7 +3593,9 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
vs. the call expression. */
if (modify_dest)
caller_type = TREE_TYPE (modify_dest);
- else
+ else if (return_slot)
+ caller_type = TREE_TYPE (return_slot);
+ else /* No LHS on the call. */
caller_type = TREE_TYPE (TREE_TYPE (callee));
/* We don't need to do anything for functions that don't return anything. */
@@ -3634,6 +3636,10 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
&& !DECL_GIMPLE_REG_P (result)
&& DECL_P (var))
DECL_GIMPLE_REG_P (var) = 0;
+
+ if (!useless_type_conversion_p (callee_type, caller_type))
+ var = build1 (VIEW_CONVERT_EXPR, callee_type, var);
+
use = NULL;
goto done;
}