tree-inline.c (copy_body_r): Explicitly copy a constant if the type will be remapped.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Wed, 24 Nov 2004 20:19:36 +0000 (20:19 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 24 Nov 2004 20:19:36 +0000 (15:19 -0500)
* tree-inline.c (copy_body_r): Explicitly copy a constant if the
type will be remapped.

From-SVN: r91192

gcc/ChangeLog
gcc/tree-inline.c

index f6af7177b160dd9a97cfc04d3b6d669910f8c2a0..91878f82d160b195b1d9bd73da6b15ccfa658d17 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-24  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * tree-inline.c (copy_body_r): Explicitly copy a constant if the
+       type will be remapped.
+
 2004-11-24  Steven Bosscher  <stevenb@suse.de>
 
        * c-opts.c (c_common_post_options): Don't clear
index 82a6a92a37708f10c433efd9ec6f8a2f1ef1abc3..a6629895b43b305a2a168523bfacd216f4d23238 100644 (file)
@@ -516,6 +516,25 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
   else if (TYPE_P (*tp))
     *tp = remap_type (*tp, id);
 
+  /* If this is a constant, we have to copy the node iff the type will be
+     remapped.  copy_tree_r will not copy a constant.  */
+  else if (TREE_CODE_CLASS (TREE_CODE (*tp)) == tcc_constant)
+    {
+      tree new_type = remap_type (TREE_TYPE (*tp), id);
+
+      if (new_type == TREE_TYPE (*tp))
+       *walk_subtrees = 0;
+
+      else if (TREE_CODE (*tp) == INTEGER_CST)
+       *tp = build_int_cst_wide (new_type, TREE_INT_CST_LOW (*tp),
+                                 TREE_INT_CST_HIGH (*tp));
+      else
+       {
+         *tp = copy_node (*tp);
+         TREE_TYPE (*tp) = new_type;
+       }
+    }
+
   /* Otherwise, just copy the node.  Note that copy_tree_r already
      knows not to copy VAR_DECLs, etc., so this is safe.  */
   else