This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR middle-end/39345: [4.4 Regression] ICE in copy_tree_body_r, at tree-inline.c:1020
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 3 Mar 2009 07:24:35 -0800
- Subject: PATCH: PR middle-end/39345: [4.4 Regression] ICE in copy_tree_body_r, at tree-inline.c:1020
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
can_be_nonlocal calls remap_type which will remap type. But the newly
remapped type isn't stored anywhere. This patch adds remapped_type and
uses it in can_be_nonlocal instead. OK for trunk?
Thanks.
H.J.
---
2009-03-03 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/39345
* tree-inline.c (remapped_type): New.
(can_be_nonlocal): Call remapped_type instead of remap_type.
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c (revision 144529)
+++ gcc/tree-inline.c (working copy)
@@ -426,6 +426,23 @@ remap_type (tree type, copy_body_data *i
return tmp;
}
+static tree
+remapped_type (tree type, copy_body_data *id)
+{
+ tree *node;
+
+ if (type == NULL)
+ return type;
+
+ /* See if we have remapped this type. */
+ node = (tree *) pointer_map_contains (id->decl_map, type);
+ if (node)
+ return *node;
+ else
+ return NULL;
+}
+
+ /* The type only needs remapping if it's variably modified. */
/* Decide if DECL can be put into BLOCK_NONLOCAL_VARs. */
static bool
@@ -446,8 +463,10 @@ can_be_nonlocal (tree decl, copy_body_da
if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != PARM_DECL)
return false;
- /* We must use global type. */
- if (TREE_TYPE (decl) != remap_type (TREE_TYPE (decl), id))
+ /* We must use global type. We call remapped_type instead of
+ remap_type since we don't want to remap this type here if it
+ hasn't been remapped before. */
+ if (TREE_TYPE (decl) != remapped_type (TREE_TYPE (decl), id))
return false;
/* Wihtout SSA we can't tell if variable is used. */