diff mbox series

Fix PR92409

Message ID nycvar.YFH.7.76.1911081413520.5566@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR92409 | expand

Commit Message

Richard Biener Nov. 8, 2019, 1:14 p.m. UTC
The following fixes an ICE with the recent relaxing of type
constraints for inlining.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

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.
diff mbox series

Patch

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c	(revision 277955)
+++ gcc/tree-inline.c	(working copy)
@@ -3593,7 +3593,9 @@  declare_return_variable (copy_body_data
      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
 	  && !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;
     }