OSDN Git Service

Revert these changes:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Apr 2002 01:25:27 +0000 (01:25 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Apr 2002 01:25:27 +0000 (01:25 +0000)
2002-04-06  Mark Mitchell  <mark@codesourcery.com>

PR c++/5571
* stor-layout.c (layout_decl): Reset the RTL for the decl.

* decl.c (duplicate_decls): Do not copy the RTL for a variable
declaration if the old variable had an incomplete type and the new
variable does not.
(complete_vars): Do not call layout_decl for completed variables.

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

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/stor-layout.c

index 25d865e..86df46d 100644 (file)
@@ -1,3 +1,12 @@
+2002-04-12  Mark Mitchell  <mark@codesourcery.com>
+
+       Revert these changes:
+
+       2002-04-06  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/5571
+       * stor-layout.c (layout_decl): Reset the RTL for the decl.
+
 2002-04-12  Richard Henderson  <rth@redhat.com>
 
        * config.gcc (sparcv9-*-solaris2): Default to 32-bit code.
index a9b70e9..c075ed0 100644 (file)
@@ -1,3 +1,10 @@
+2002-04-12  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (duplicate_decls): Do not copy the RTL for a variable
+       declaration if the old variable had an incomplete type and the new
+       variable does not.
+       (complete_vars): Do not call layout_decl for completed variables.
+
 2002-04-12  Richard Sandiford  <rsandifo@redhat.com>
 
        * decl.c (duplicate_decls): Don't try to unify an implicit typedef
index 93e6305..721cd63 100644 (file)
@@ -3610,15 +3610,23 @@ duplicate_decls (newdecl, olddecl)
       if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
        DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
 
-      /* Keep the old rtl since we can safely use it.  */
-      COPY_DECL_RTL (olddecl, newdecl);
-
       if (TREE_CODE (newdecl) == FUNCTION_DECL)
        {
          DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
            |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
          DECL_NO_LIMIT_STACK (newdecl)
            |= DECL_NO_LIMIT_STACK (olddecl);
+         /* Keep the old RTL.  */
+         COPY_DECL_RTL (olddecl, newdecl);
+       }
+      else if (TREE_CODE (newdecl) == VAR_DECL 
+              && (DECL_SIZE (olddecl) || !DECL_SIZE (newdecl)))
+       {
+         /* Keep the old RTL.  We cannot keep the old RTL if the old
+            declaration was for an incomplete object and the new
+            declaration is not since many attributes of the RTL will
+            change.  */
+         COPY_DECL_RTL (olddecl, newdecl);
        }
     }
   /* If cannot merge, then use the new type and qualifiers,
@@ -14529,11 +14537,9 @@ complete_vars (type)
       if (same_type_p (type, TREE_PURPOSE (*list)))
        {
          tree var = TREE_VALUE (*list);
-         /* Make sure that the type of the VAR has been laid out.  It
-            might not have been if the type of VAR is an array.  */
-         layout_type (TREE_TYPE (var));
-         /* Lay out the variable itself.  */
-         layout_decl (var, 0);
+         /* Complete the type of the variable.  The VAR_DECL itself
+            will be laid out in expand_expr.  */
+         complete_type (TREE_TYPE (var));
          /* Remove this entry from the list.  */
          *list = TREE_CHAIN (*list);
        }
index fbf5e4f..baf26dd 100644 (file)
@@ -461,11 +461,6 @@ layout_decl (decl, known_align)
                               larger_than_size);
        }
     }
-
-  /* If there was already RTL for this DECL, as for a variable with an
-     incomplete type whose type is completed later, update the RTL.  */
-  if (DECL_RTL_SET_P (decl))
-    make_decl_rtl (decl, NULL);
 }
 \f
 /* Hook for a front-end function that can modify the record layout as needed