[Bug ipa/92409] [10 regression] r277920 causes ICE in gcc.dg/cast-function-1.c
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 8 09:53:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92409
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the fix is more like the following to make declare_return_variable
notice the mismatch. That alone might not be enough but the fix should be
there. I assume that we use a return slot only for non-registers
because those are the only valid uses of VIEW_CONVERT_EXPRs on lvalues.
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;
}
More information about the Gcc-bugs
mailing list