aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-11-26 17:47:48 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-11-26 17:47:48 +0000
commit90dcfecb47a75e10277dcdd44aeb39267d251f36 (patch)
treef723e62fba44367868ca69c568eb0c1239b6f03e /gcc
parentda49a7837ae5c1aba8ff5768efb4834ceefdea47 (diff)
downloadgcc-90dcfecb47a75e10277dcdd44aeb39267d251f36.zip
gcc-90dcfecb47a75e10277dcdd44aeb39267d251f36.tar.gz
gcc-90dcfecb47a75e10277dcdd44aeb39267d251f36.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/utils.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 67f8011..298dda2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
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
of the operator on both branches of the test in the generic case.
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 4d1cd97..38795a0 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -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);