[Bug c++/12370] [3.4 regression] wrong code when adding friend

rth at redhat dot com gcc-bugzilla@gcc.gnu.org
Sat Sep 27 01:01:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12370



------- Additional Comments From rth at redhat dot com  2003-09-26 22:56 -------
Subject: Re:  [3.4 regression] wrong code when adding friend

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.



More information about the Gcc-bugs mailing list