re PR c/8467 (Bug in sibling call optimization)
authorFranz Sirl <Franz.Sirl-kernel@lauterbach.com>
Mon, 11 Nov 2002 21:29:19 +0000 (21:29 +0000)
committerFranz Sirl <sirl@gcc.gnu.org>
Mon, 11 Nov 2002 21:29:19 +0000 (21:29 +0000)
2002-11-11  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

PR c/8467
* gcc.c-torture/execute/20021111-1.c

From-SVN: r59026

gcc/ChangeLog
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20021111-1.c [new file with mode: 0644]

index dcc0bd2570b60973e46420b15275d72471006aa1..7b06a1e64672de00593adf5dec6934f3ca4306b2 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-11  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       PR c/8467
+       * stmt.c (tail_recursion_args): Handle DECL_MODE differing from the
+       mode of DECL_RTL case.
+
 2002-11-11  Janis Johnson  <janis187@us.ibm.com>
 
        * doc/contrib.texi: Merge in the list from the libstdc++ web pages.
index c07fe663fb3ad735ae424bc7d7d4b978a2b21523..360abe195712bcf9124e8316cb334ab82d00eef7 100644 (file)
@@ -3311,8 +3311,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 ();
index 99af5fe5eeb9c0ff9b17b5ca6805f834fe769aa3..2a8434fa526f828bdafcf76c694e1032ec865738 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-11  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       PR c/8467
+       * gcc.c-torture/execute/20021111-1.c
+
 2002-11-09  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR c/8439
diff --git a/gcc/testsuite/gcc.c-torture/execute/20021111-1.c b/gcc/testsuite/gcc.c-torture/execute/20021111-1.c
new file mode 100644 (file)
index 0000000..b81fa0b
--- /dev/null
@@ -0,0 +1,31 @@
+/* Origin: PR c/8467 */
+
+extern void abort (void);
+extern void exit (int);
+
+int aim_callhandler(int sess, int conn, unsigned short family, unsigned short type);
+
+int aim_callhandler(int sess, int conn, unsigned short family, unsigned short type)
+{
+  static int i = 0;
+
+  if (!conn)
+    return 0;
+
+  if (type == 0xffff)
+    {
+      return 0;
+    }
+
+  if (i >= 1)
+    abort ();
+
+  i++;
+  return aim_callhandler(sess, conn, family, (unsigned short) 0xffff);
+}
+
+int main (void)
+{
+  aim_callhandler (0, 1, 0, 0);
+  exit (0);
+}