This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Force copying of constant of remappable type


We discussed this a while ago in connection with a failure to compile
the Ada front end with -gnatn enabled, but I want to make sure this is
what we agreed was the right fix.

Tested on x86_64-linux-gnu.

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.

*** tree-inline.c	24 Nov 2004 11:41:32 -0000	1.151
--- tree-inline.c	24 Nov 2004 14:55:06 -0000
*************** copy_body_r (tree *tp, int *walk_subtree
*** 517,520 ****
--- 517,539 ----
      *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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]