OSDN Git Service

* gcc-interface/utils.c (copy_type): Unshare the language-specific data
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 Nov 2009 17:47:48 +0000 (17:47 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 Nov 2009 17:47:48 +0000 (17:47 +0000)
and the contents of the language-specific slot if needed.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154678 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c

index 67f8011..298dda2 100644 (file)
@@ -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.
 
index 4d1cd97..38795a0 100644 (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);