This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug c++/12370] [3.4 regression] wrong code when adding friend
- From: Richard Henderson <rth at redhat dot com>
- To: pinskia at gcc dot gnu dot org <gcc-bugzilla at gcc dot gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Sep 2003 15:56:17 -0700
- Subject: Re: [Bug c++/12370] [3.4 regression] wrong code when adding friend
- References: <20030922204035.12370.reichelt@gcc.gnu.org> <20030923021225.8999.qmail@sources.redhat.com>
On Tue, Sep 23, 2003 at 02:12:25AM -0000, pinskia at gcc dot gnu dot org wrote:
> Looks some thing is going wrong because of the friend, maybe another GC
> problem again?
Not a gc problem, exactly. It is fallout from one of my patches however.
We were losing track of the fact that nrvo was to be applied, by losing
track of the cached information in cfun.
The following cures the given test case; general testing to follow.
r~
* decl.c (duplicate_decls): Copy DECL_SAVED_INSNS too.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1133
diff -c -p -d -u -r1.1133 decl.c
--- decl.c 26 Sep 2003 15:21:30 -0000 1.1133
+++ decl.c 26 Sep 2003 22:52:54 -0000
@@ -3206,7 +3206,10 @@ duplicate_decls (tree newdecl, tree oldd
if (CAN_HAVE_FULL_LANG_DECL_P (newdecl)
&& DECL_LANG_SPECIFIC (newdecl)
&& DECL_LANG_SPECIFIC (olddecl))
- DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
+ {
+ DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
+ DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl);
+ }
}
/* Merge the section attribute.