This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/7145: g++ -O with structure initializer & returnvalue optimization generates bad code
- From: "H.J. Lu" <hjl at lucon dot org>
- To: gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, tlb at tlb dot org,gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org?Subject=Re:,optimization/ at lucon dot org
- Date: Fri, 28 Jun 2002 22:27:33 -0700
- Subject: 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)