This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for 17526
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 31 Oct 2004 04:38:04 -0500
- Subject: PATCH for 17526
The problem turned out to be that we were leaving the assignment as *p =
foo() even when foo does not return in memory, and tree-tailcall seems to
assume that an assignment does not preclude a tailcall all by itself. If
we're making that assumption, we need to use a temporary unless foo returns
in memory. Actually checking whether a type is returned in memory caused
problems before, so I just check for BLKmode; using a temporary in a few
cases where it isn't necessary shouldn't be a big deal if the type is
small, which it must be if it doesn't have BLKmode.
Tested x86_64-pc-linux-gnu, applied to trunk. Testcase soon.
2004-10-31 Jason Merrill <jason@redhat.com>
PR middle-end/17526
* tree-gimple.c (is_gimple_mem_rhs): Also require a val for
aggregate types that are not BLKmode.
*** tree-gimple.c.~1~ 2004-09-27 15:37:47.000000000 -0400
--- tree-gimple.c 2004-10-29 17:46:55.414741746 -0400
*************** is_gimple_reg_rhs (tree t)
*** 111,119 ****
bool
is_gimple_mem_rhs (tree t)
{
! /* If we're dealing with a renamable type, either source or dest
! must be a renamed variable. */
! if (is_gimple_reg_type (TREE_TYPE (t)))
return is_gimple_val (t);
else
return is_gimple_formal_tmp_rhs (t);
--- 111,122 ----
bool
is_gimple_mem_rhs (tree t)
{
! /* If we're dealing with a renamable type, either source or dest must be
! a renamed variable. Also force a temporary if the type doesn't need
! to be stored in memory, since it's cheap and prevents erroneous
! tailcalls (PR 17526). */
! if (is_gimple_reg_type (TREE_TYPE (t))
! || TYPE_MODE (TREE_TYPE (t)) != BLKmode)
return is_gimple_val (t);
else
return is_gimple_formal_tmp_rhs (t);