OSDN Git Service

PR c/10201
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Apr 2003 16:22:29 +0000 (16:22 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Apr 2003 16:22:29 +0000 (16:22 +0000)
        * expr.c (expand_expr): Move DECL_RTL frobbing ...
        * stor-layout.c (layout_decl): ... here.

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

gcc/ChangeLog
gcc/expr.c
gcc/stor-layout.c
gcc/testsuite/gcc.c-torture/compile/20030410-1.c [new file with mode: 0644]

index 0df55f0..ea6055b 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-11  Richard Henderson  <rth@redhat.com>
+
+       PR c/10201
+       * expr.c (expand_expr): Move DECL_RTL frobbing ...
+       * stor-layout.c (layout_decl): ... here.
+
 2003-04-11  James A. Morrison <ja2morri@uwaterloo.ca>
 
        * doc/invoke.texi: Eliminate extra white-space caused by
index a2b547e..3d8903d 100644 (file)
@@ -6714,21 +6714,7 @@ expand_expr (exp, target, tmode, modifier)
         but the type is complete now, lay out the decl now.  */
       if (DECL_SIZE (exp) == 0 && COMPLETE_TYPE_P (TREE_TYPE (exp))
          && (TREE_STATIC (exp) || DECL_EXTERNAL (exp)))
-       {
-         rtx value = DECL_RTL_IF_SET (exp);
-
-         layout_decl (exp, 0);
-
-         /* If the RTL was already set, update its mode and memory
-            attributes.  */
-         if (value != 0)
-           {
-             PUT_MODE (value, DECL_MODE (exp));
-             SET_DECL_RTL (exp, 0);
-             set_mem_attributes (value, exp, 1);
-             SET_DECL_RTL (exp, value);
-           }
-       }
+       layout_decl (exp, 0);
 
       /* ... fall through ...  */
 
index 106c7c6..c592fa4 100644 (file)
@@ -390,6 +390,7 @@ layout_decl (decl, known_align)
 {
   tree type = TREE_TYPE (decl);
   enum tree_code code = TREE_CODE (decl);
+  rtx rtl = NULL_RTX;
 
   if (code == CONST_DECL)
     return;
@@ -397,6 +398,8 @@ layout_decl (decl, known_align)
           && code != TYPE_DECL && code != FIELD_DECL)
     abort ();
 
+  rtl = DECL_RTL_IF_SET (decl);
+
   if (type == error_mark_node)
     type = void_type_node;
 
@@ -542,6 +545,15 @@ layout_decl (decl, known_align)
                               larger_than_size);
        }
     }
+
+  /* If the RTL was already set, update its mode and mem attributes.  */
+  if (rtl)
+    {
+      PUT_MODE (rtl, DECL_MODE (decl));
+      SET_DECL_RTL (decl, 0);
+      set_mem_attributes (rtl, decl, 1);
+      SET_DECL_RTL (decl, rtl);
+    }
 }
 \f
 /* Hook for a front-end function that can modify the record layout as needed
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030410-1.c b/gcc/testsuite/gcc.c-torture/compile/20030410-1.c
new file mode 100644 (file)
index 0000000..9127ede
--- /dev/null
@@ -0,0 +1,27 @@
+/* PR 10201 */
+
+extern struct _zend_compiler_globals compiler_globals;
+typedef struct _zend_executor_globals zend_executor_globals;
+extern zend_executor_globals executor_globals;
+
+typedef struct _zend_ptr_stack {
+        int top;
+        void **top_element;
+} zend_ptr_stack;
+struct _zend_compiler_globals {
+};
+struct _zend_executor_globals {
+        int *uninitialized_zval_ptr;
+        zend_ptr_stack argument_stack;
+};
+
+static inline void safe_free_zval_ptr(int *p)
+{
+        if (p!=(executor_globals.uninitialized_zval_ptr)) {
+        }
+}
+zend_executor_globals executor_globals;
+static inline void zend_ptr_stack_clear_multiple(void)
+{
+        executor_globals.argument_stack.top -= 2;
+}