This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix tree-inlinine ICE with uninitializer return value


Hi,
the code path handling the case where callee is missing return statement but calle
statement has LHS is broken in tree-inline since anonymous SSA_NAMEs was introduced.
This code is not not used because all those inlines are disabled by 
gimple_check_call_matching_types, but since I would like to drop the checks it seems
good idea to fix the code path rather than dropping it.  This copies what Jakub's
code does when redirecting to unreachable.

Bootstrapped/regtesetd x86_64-linux, OK?

Honza

	* tree-inline.c (expand_call_inline): Fix path inlining function
	with no return statement.
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 235839)
+++ tree-inline.c	(working copy)
@@ -4708,7 +4708,7 @@ expand_call_inline (basic_block bb, gimp
 	{
 	  tree name = gimple_call_lhs (stmt);
 	  tree var = SSA_NAME_VAR (name);
-	  tree def = ssa_default_def (cfun, var);
+	  tree def = var ? ssa_default_def (cfun, var) : NULL;
 
 	  if (def)
 	    {
@@ -4719,6 +4719,11 @@ expand_call_inline (basic_block bb, gimp
 	    }
 	  else
 	    {
+	      if (!var)
+		{
+		  tree var = create_tmp_reg_fn (cfun, TREE_TYPE (name), NULL);
+		  SET_SSA_NAME_VAR_OR_IDENTIFIER (name, var);
+		}
 	      /* Otherwise make this variable undefined.  */
 	      gsi_remove (&stmt_gsi, true);
 	      set_ssa_default_def (cfun, var, name);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]