c/8467: Bug in sibling call optimization
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Thu Nov 7 13:16:00 GMT 2002
The following reply was made to PR c/8467; it has been noted by GNATS.
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: gcc-gnats@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org,
gcc-patches@gcc.gnu.org,
Mark Mitchell <mark@codesourcery.com>
Subject: Re: c/8467: Bug in sibling call optimization
Date: Thu, 7 Nov 2002 22:12:01 +0100
--------------Boundary-00=_1K58ZGKQV14TE1LTMPZF
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
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.
--------------Boundary-00=_1K58ZGKQV14TE1LTMPZF
Content-Type: text/plain;
charset="iso-8859-1";
name="gcc-tailrecursion.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="gcc-tailrecursion.patch"
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 ();
--------------Boundary-00=_1K58ZGKQV14TE1LTMPZF--
More information about the Gcc-prs
mailing list