OSDN Git Service

(copy_constant): Copy operand of ADDR_EXPR if it is a constant.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Mar 1995 19:28:07 +0000 (19:28 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Mar 1995 19:28:07 +0000 (19:28 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9164 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/varasm.c

index 537d9b2..818628b 100644 (file)
@@ -2568,12 +2568,18 @@ copy_constant (exp)
 {
   switch (TREE_CODE (exp))
     {
+    case ADDR_EXPR:
+      /* For ADDR_EXPR, we do not want to copy the decl whose address
+        is requested.  We do want to copy constants though.  */
+      if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == 'c')
+       return build1 (TREE_CODE (exp), TREE_TYPE (exp),
+                      copy_constant (TREE_OPERAND (exp, 0)));
+      else
+       return copy_node (exp);
+
     case INTEGER_CST:
     case REAL_CST:
     case STRING_CST:
-    case ADDR_EXPR:
-      /* For ADDR_EXPR, we do not want to copy the decl
-        whose address is requested.  */
       return copy_node (exp);
 
     case COMPLEX_CST: