[PATCH] Fix PR36326 again, regressed after the tuples merge

Richard Guenther rguenther@suse.de
Wed Dec 3 14:05:00 GMT 2008


A testcase didn't get installed with the fix for PR36326 so we
regressed again with the tuples merge which copied the original unfixed
function into a new function.  Oops.  So we're back at

foo (union X * p)
{
  union X x.0;
  int D.1602;
  double D.1603;
  union X x;

  x.0 = *p;
  x = x.0;
  D.1603 = x.x;
  D.1602 = (int) D.1603;
  return D.1602;
}

Fixed again to produce x = *p.

Bootstrap / regtest running, I'll apply after that, this time with a
testcase.

Richard.

2008-12-03  Richard Guenther  <rguenther@suse.de>

	PR middle-end/36326
	* gimplify.c (is_gimple_mem_or_call_rhs): Remove work-around for
	non-BLKmode types.

	* gcc.dg/tree-ssa/pr36326.c: New testcase.

Index: gcc/testsuite/gcc.dg/tree-ssa/pr36326.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/pr36326.c	(revision 0)
--- gcc/testsuite/gcc.dg/tree-ssa/pr36326.c	(revision 0)
***************
*** 0 ****
--- 1,13 ----
+ /* { dg-do compile } */
+ /* { dg-options "-fdump-tree-gimple" } */
+ 
+ union X { int i; double x; };
+ 
+ int foo (union X *p)
+ {
+   union X x = *p;
+   return x.x;
+ }
+ 
+ /* { dg-final { scan-tree-dump-not "x.0" "gimple" } } */
+ /* { dg-final { cleanup-tree-dump "gimple" } } */
Index: gcc/gimplify.c
===================================================================
*** gcc/gimplify.c	(revision 142357)
--- gcc/gimplify.c	(working copy)
*************** static bool
*** 656,668 ****
  is_gimple_mem_or_call_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
! 	  && (TREE_CODE (t) != CALL_EXPR
!               || ! aggregate_value_p (t, t))))
      return is_gimple_val (t);
    else
      return is_gimple_formal_tmp_or_call_rhs (t);
--- 656,663 ----
  is_gimple_mem_or_call_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_or_call_rhs (t);



More information about the Gcc-patches mailing list