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]

[tree-ssa] fix middle-end/14218


        PR middle-end/14218
        * c-simplify.c (mark_labels_r): Move to ...
        * gimplify.c (force_labels_r): ... here, and rename.
        (gimplify_init_constructor): Invoke it.
        * tree-simple.h (force_labels_r): Declare.

Index: gcc/c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.92
diff -u -p -r1.1.4.92 c-simplify.c
--- gcc/c-simplify.c	6 Feb 2004 15:20:29 -0000	1.1.4.92
+++ gcc/c-simplify.c	20 Feb 2004 18:48:15 -0000
@@ -821,19 +821,6 @@ gimplify_return_stmt (tree *stmt_p)
   return GS_OK;
 }
 
-/* walk_tree helper function for gimplify_decl_stmt.  */
-
-static tree
-mark_labels_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
-{
-  if (TYPE_P (*tp))
-    *walk_subtrees = 0;
-  if (TREE_CODE (*tp) == LABEL_DECL)
-    FORCED_LABEL (*tp) = 1;
-
-  return NULL_TREE;
-}
-
 /* Gimplifies a DECL_STMT node T.
 
    If a declaration V has an initial value I, create an expression 'V = I'
@@ -907,7 +894,7 @@ gimplify_decl_stmt (tree *stmt_p)
 	    {
 	      /* We must still examine initializers for static variables
 		 as they may contain a label address.  */
-	      walk_tree (&init, mark_labels_r, NULL, NULL);
+	      walk_tree (&init, force_labels_r, NULL, NULL);
 	    }
 	}
 
Index: gcc/gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v
retrieving revision 1.1.2.142
diff -u -p -r1.1.2.142 gimplify.c
--- gcc/gimplify.c	16 Feb 2004 12:35:55 -0000	1.1.2.142
+++ gcc/gimplify.c	20 Feb 2004 18:48:16 -0000
@@ -1101,6 +1101,20 @@ gimplify_exit_expr (tree *expr_p)
   return GS_OK;
 }
 
+/* A helper function to be called via walk_tree.  Mark all labels under *TP
+   as being forced.  To be called for DECL_INITIAL of static variables.  */
+
+tree
+force_labels_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
+{
+  if (TYPE_P (*tp))
+    *walk_subtrees = 0;
+  if (TREE_CODE (*tp) == LABEL_DECL)
+    FORCED_LABEL (*tp) = 1;
+
+  return NULL_TREE;
+}
+
 /* Break out elements of a constructor used as an initializer into separate
    MODIFY_EXPRs.
 
@@ -1163,6 +1177,7 @@ gimplify_init_constructor (tree *expr_p,
 	    TREE_STATIC (object) = 1;
 	    if (!DECL_NAME (object))
 	      DECL_NAME (object) = create_tmp_var_name ("C");
+	    walk_tree (&DECL_INITIAL (object), force_labels_r, NULL, NULL);
 
 	    /* ??? C++ doesn't automatically append a .<number> to the
 	       assembler name, and even when it does, it looks a FE private
@@ -1214,6 +1229,7 @@ gimplify_init_constructor (tree *expr_p,
 		    DECL_ALIGN (new) = align;
 		    DECL_USER_ALIGN (new) = 1;
 		  }
+	        walk_tree (&DECL_INITIAL (new), force_labels_r, NULL, NULL);
 
 		TREE_OPERAND (*expr_p, 1) = new;
 		break;
Index: gcc/tree-simple.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-simple.h,v
retrieving revision 1.1.4.48
diff -u -p -r1.1.4.48 tree-simple.h
--- gcc/tree-simple.h	16 Feb 2004 12:36:01 -0000	1.1.4.48
+++ gcc/tree-simple.h	20 Feb 2004 18:48:16 -0000
@@ -121,6 +121,7 @@ tree gimple_build_eh_filter (tree, tree,
 tree build_and_jump (tree *);
 tree alloc_stmt_list (void);
 void free_stmt_list (tree);
+tree force_labels_r (tree *, int *, void *);
 
 /* In tree-nested.c.  */
 extern void lower_nested_functions (tree);


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