This is the mail archive of the gcc-bugs@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]

Re: optimization/7145: g++ -O with structure initializer & returnvalue optimization generates bad code


How about this patch?

H.J.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7145

2002-06-28  H.J. Lu  (hjl@gnu.org)

	* typeck.c (check_return_expr): Don't set
	current_function_return_value if DECL_INITIAL (retval) is not
	NULL_TREE.

--- gcc/cp/typeck.c.init	Fri Jun 21 00:36:03 2002
+++ gcc/cp/typeck.c	Fri Jun 28 22:09:39 2002
@@ -6559,6 +6559,7 @@ check_return_expr (retval)
 	  && (current_function_return_value == NULL_TREE
 	      || current_function_return_value == retval)
 	  && TREE_CODE (retval) == VAR_DECL
+	  && DECL_INITIAL (retval) == NULL_TREE
 	  && DECL_CONTEXT (retval) == current_function_decl
 	  && ! TREE_STATIC (retval)
 	  && (DECL_ALIGN (retval)

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