c/8467: Bug in sibling call optimization

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Nov 7 13:11:00 GMT 2002


Hi,

it turns out this bug is easily fixed with an intermediate move insn covering 
the case when DECL_MODE differs from the mode of the DECL_RTL.

Bootstrap on powerpc-linux-gnu is currently runnning.

OK to commit patch&testcase to mainline and branch after the bootstrap 
completed successfully?

Franz.


	PR c/8467
	* stmt.c (tail_recursion_args): Handle DECL_MODE differing from the
	mode of DECL_RTL case.

-------------- next part --------------
Index: gcc/stmt.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.248.2.4
diff -u -p -r1.248.2.4 stmt.c
--- gcc/stmt.c	17 Apr 2002 01:43:57 -0000	1.248.2.4
+++ gcc/stmt.c	7 Nov 2002 20:51:44 -0000
@@ -3351,8 +3351,18 @@ tail_recursion_args (actuals, formals)
       if (GET_MODE (DECL_RTL (f)) == GET_MODE (argvec[i]))
 	emit_move_insn (DECL_RTL (f), argvec[i]);
       else
-	convert_move (DECL_RTL (f), argvec[i],
-		      TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
+	{
+	  rtx tmp = argvec[i];
+
+	  if (DECL_MODE (f) != GET_MODE (DECL_RTL (f)))
+	    {
+	      tmp = gen_reg_rtx (DECL_MODE (f));
+	      convert_move (tmp, argvec[i],
+			    TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
+	    }
+	  convert_move (DECL_RTL (f), tmp,
+			TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
+	}
     }
 
   free_temp_slots ();


More information about the Gcc-bugs mailing list