[PATCH] Fix PR27218

Richard Guenther rguenther@suse.de
Sun Apr 23 11:22:00 GMT 2006


Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for mainline/4.1?

Thank,s
Richard.

:ADDPATCH middle-end:

2006-04-23  Andrew Pinski  <pinskia@gcc.gnu.org>
	Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/27218
	* tree-inline.c (expand_call_inline): Strip useless type
	conversions for the return slot address.

	* g++.dg/torture/pr27218.C: New testcase.

Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 113168)
--- tree-inline.c	(working copy)
*************** expand_call_inline (basic_block bb, tree
*** 2073,2078 ****
--- 2078,2084 ----
        if (CALL_EXPR_RETURN_SLOT_OPT (t))
  	{
  	  return_slot_addr = build_fold_addr_expr (modify_dest);
+ 	  STRIP_USELESS_TYPE_CONVERSION (return_slot_addr);
  	  modify_dest = NULL;
  	}
      }

/* { dg-do compile } */

struct Vector
{
    double _x, _y;
};
typedef Vector Point;
Vector d;
static inline Vector f(void)
{
  return d;
}
void add_duck (void)
{
    new Point (f());
}



More information about the Gcc-patches mailing list