diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2004-11-24 20:19:36 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2004-11-24 15:19:36 -0500 |
commit | bb04998ab783bff53eb995de3e7d38a4eba2f06e (patch) | |
tree | 89c073f6216329698dde15b2256c05fc2dccd7b4 | |
parent | 8adb21944ef60bd5371c3b3de031da69fe700cbc (diff) | |
download | gcc-bb04998ab783bff53eb995de3e7d38a4eba2f06e.zip gcc-bb04998ab783bff53eb995de3e7d38a4eba2f06e.tar.gz gcc-bb04998ab783bff53eb995de3e7d38a4eba2f06e.tar.bz2 |
tree-inline.c (copy_body_r): Explicitly copy a constant if the type will be remapped.
* tree-inline.c (copy_body_r): Explicitly copy a constant if the
type will be remapped.
From-SVN: r91192
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-inline.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6af717..91878f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 82a6a92..a662989 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -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 |