[backport gcc-4.8/trunk r196511 ] gcc/ 2013-03-06 Jakub Jelinek PR tree-optimization/56539 * tree-tailcall.c (adjust_return_value_with_ops): Use GSI_SAME_STMT instead of GSI_CONTINUE_LINKING as last argument to force_gimple_operand_gsi. Adjust function comment. gcc/testsuite/ 2013-03-06 Jakub Jelinek PR tree-optimization/56539 * gcc.c-torture/compile/pr56539.c: New test. --- gcc-4.7.2/gcc/testsuite/gcc.c-torture/compile/pr56539.c.~1~ 1970-01-01 01:00:00.000000000 +0100 +++ gcc-4.7.2/gcc/testsuite/gcc.c-torture/compile/pr56539.c 2013-03-09 12:49:53.843339823 +0100 @@ -0,0 +1,7 @@ +/* PR tree-optimization/56539 */ + +short +foo (const char *x, unsigned y) +{ + return y > 1 ? (x[y - 1] - '0') + 10 * foo (x, y - 1) : (*x - '0'); +} --- gcc-4.7.2/gcc/tree-tailcall.c.~1~ 2012-02-16 23:20:27.000000000 +0100 +++ gcc-4.7.2/gcc/tree-tailcall.c 2013-03-09 12:51:54.812759798 +0100 @@ -601,8 +601,8 @@ add_successor_phi_arg (edge e, tree var, } /* Creates a GIMPLE statement which computes the operation specified by - CODE, OP0 and OP1 to a new variable with name LABEL and inserts the - statement in the position specified by GSI and UPDATE. Returns the + CODE, ACC and OP1 to a new variable with name LABEL and inserts the + statement in the position specified by GSI. Returns the tree node of the statement's result. */ static tree @@ -627,7 +627,7 @@ adjust_return_value_with_ops (enum tree_ fold_convert (TREE_TYPE (op1), acc), op1)); rhs = force_gimple_operand_gsi (&gsi, rhs, - false, NULL, true, GSI_CONTINUE_LINKING); + false, NULL, true, GSI_SAME_STMT); stmt = gimple_build_assign (NULL_TREE, rhs); }