utils.c (copy_type): Unshare the language-specific data and the contents of the language-specific...

* gcc-interface/utils.c (copy_type): Unshare the language-specific data
	and the contents of the language-specific slot if needed.

From-SVN: r154678
This commit is contained in:
Eric Botcazou 2009-11-26 17:47:48 +00:00 committed by Eric Botcazou
parent da49a7837a
commit 90dcfecb47
2 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-11-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (copy_type): Unshare the language-specific data
and the contents of the language-specific slot if needed.
2009-11-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (gnat_to_gnu) <N_In>: Set the source location

View File

@ -1157,6 +1157,23 @@ copy_type (tree type)
{
tree new_type = copy_node (type);
/* Unshare the language-specific data. */
if (TYPE_LANG_SPECIFIC (type))
{
TYPE_LANG_SPECIFIC (new_type) = NULL;
SET_TYPE_LANG_SPECIFIC (new_type, GET_TYPE_LANG_SPECIFIC (type));
}
/* And the contents of the language-specific slot if needed. */
if ((INTEGRAL_TYPE_P (type) || TREE_CODE (type) == REAL_TYPE)
&& TYPE_RM_VALUES (type))
{
TYPE_RM_VALUES (new_type) = NULL_TREE;
SET_TYPE_RM_SIZE (new_type, TYPE_RM_SIZE (type));
SET_TYPE_RM_MIN_VALUE (new_type, TYPE_RM_MIN_VALUE (type));
SET_TYPE_RM_MAX_VALUE (new_type, TYPE_RM_MAX_VALUE (type));
}
/* copy_node clears this field instead of copying it, because it is
aliased with TREE_CHAIN. */
TYPE_STUB_DECL (new_type) = TYPE_STUB_DECL (type);