LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File nov141311.diff of Package gcc33 (Project openSUSE:Factory)

===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.282.4.6
retrieving revision 1.282.4.7
Index: gcc-3.3.3/gcc/cp/semantics.c
===================================================================
--- gcc-3.3.3.orig/gcc/cp/semantics.c	2009-11-20 13:04:57.000000000 +0100
+++ gcc-3.3.3/gcc/cp/semantics.c	2009-11-20 13:06:45.000000000 +0100
@@ -2531,7 +2531,28 @@ nullify_returns_r (tp, walk_subtrees, da
   else if (TREE_CODE (*tp) == CLEANUP_STMT
 	   && CLEANUP_DECL (*tp) == nrv)
     CLEANUP_EH_ONLY (*tp) = 1;
-
+  /* Replace the DECL_STMT for the NRV with an initialization of the
+     RESULT_DECL, if needed.  */
+  else if (TREE_CODE (*tp) == DECL_STMT
+	   && DECL_STMT_DECL (*tp) == nrv)
+    {
+      tree init;
+      if (DECL_INITIAL (nrv)
+	  && DECL_INITIAL (nrv) != error_mark_node)
+	{
+	  init = build (INIT_EXPR, void_type_node,
+			DECL_RESULT (current_function_decl),
+			DECL_INITIAL (nrv));
+	  DECL_INITIAL (nrv) = error_mark_node;
+	}
+      else
+	init = NULL_TREE;
+      init = build_stmt (EXPR_STMT, init);
+      TREE_CHAIN (init) = TREE_CHAIN (*tp);
+      STMT_LINENO (init) = STMT_LINENO (*tp);
+      *tp = init;
+    }
+ 
   /* Keep iterating.  */
   return NULL_TREE;
 }