From: Franz Sirl Date: Mon, 11 Nov 2002 21:29:19 +0000 (+0000) Subject: re PR c/8467 (Bug in sibling call optimization) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=303b90b00106ed64c731827336490830ebf6ca4a;p=gcc.git re PR c/8467 (Bug in sibling call optimization) 2002-11-11 Franz Sirl PR c/8467 * gcc.c-torture/execute/20021111-1.c From-SVN: r59026 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dcc0bd2570b..7b06a1e6467 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-11-11 Franz Sirl + + PR c/8467 + * stmt.c (tail_recursion_args): Handle DECL_MODE differing from the + mode of DECL_RTL case. + 2002-11-11 Janis Johnson * doc/contrib.texi: Merge in the list from the libstdc++ web pages. diff --git a/gcc/stmt.c b/gcc/stmt.c index c07fe663fb3..360abe19571 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 99af5fe5eeb..2a8434fa526 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-11-11 Franz Sirl + + PR c/8467 + * gcc.c-torture/execute/20021111-1.c + 2002-11-09 Eric Botcazou 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 index 00000000000..b81fa0b0f88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021111-1.c @@ -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); +}