public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR44785
@ 2010-07-04 12:19 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2010-07-04 12:19 UTC (permalink / raw)
  To: gcc-patches


This fixes PR44785 - remap_type can re-allocate the pointer map
so I shouldn't reuse the slot address.

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

Richard.

2010-07-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/44785
	* tree-inline.c (initialize_inlined_parameters): Do not
	re-use pointer-map slot over remap_type call.

Index: gcc/tree-inline.c
===================================================================
*** gcc/tree-inline.c	(revision 161771)
--- gcc/tree-inline.c	(working copy)
*************** initialize_inlined_parameters (copy_body
*** 2690,2708 ****
        if (varp
  	  && TREE_CODE (*varp) == VAR_DECL)
  	{
! 	  tree def = (gimple_in_ssa_p (cfun)
  		      ? gimple_default_def (id->src_cfun, p) : NULL);
! 	  TREE_TYPE (*varp) = remap_type (TREE_TYPE (*varp), id);
  	  /* Also remap the default definition if it was remapped
  	     to the default definition of the parameter replacement
  	     by the parameter setup.  */
! 	  if (def && gimple_in_ssa_p (cfun) && is_gimple_reg (p))
  	    {
  	      tree *defp = (tree *) pointer_map_contains (id->decl_map, def);
  	      if (defp
  		  && TREE_CODE (*defp) == SSA_NAME
! 		  && SSA_NAME_VAR (*defp) == *varp)
! 		TREE_TYPE (*defp) = TREE_TYPE (*varp);
  	    }
  	}
      }
--- 2690,2709 ----
        if (varp
  	  && TREE_CODE (*varp) == VAR_DECL)
  	{
! 	  tree def = (gimple_in_ssa_p (cfun) && is_gimple_reg (p)
  		      ? gimple_default_def (id->src_cfun, p) : NULL);
! 	  tree var = *varp;
! 	  TREE_TYPE (var) = remap_type (TREE_TYPE (var), id);
  	  /* Also remap the default definition if it was remapped
  	     to the default definition of the parameter replacement
  	     by the parameter setup.  */
! 	  if (def)
  	    {
  	      tree *defp = (tree *) pointer_map_contains (id->decl_map, def);
  	      if (defp
  		  && TREE_CODE (*defp) == SSA_NAME
! 		  && SSA_NAME_VAR (*defp) == var)
! 		TREE_TYPE (*defp) = TREE_TYPE (var);
  	    }
  	}
      }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-04 12:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04 12:19 [PATCH] Fix PR44785 Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).