This is the mail archive of the
gcc-prs@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: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 29 Jun 2002 05:36:01 -0000
- Subject: Re: optimization/7145: g++ -O with structure initializer & returnvalue optimization generates bad code
- Reply-to: "H.J. Lu" <hjl at lucon dot org>
The following reply was made to PR optimization/7145; it has been noted by GNATS.
From: "H.J. Lu" <hjl@lucon.org>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, tlb@tlb.org,
gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org?Subject=Re:,
optimization/@lucon.org
Cc:
Subject: Re: optimization/7145: g++ -O with structure initializer & return
value optimization generates bad code
Date: Fri, 28 Jun 2002 22:27:33 -0700
This is a multi-part message in MIME format.
--------------020208010607060209080104
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
How about this patch?
H.J.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7145
--------------020208010607060209080104
Content-Type: text/plain;
name="gcc-cpp-named.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="gcc-cpp-named.patch"
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)
--------------020208010607060209080104--