c++/7280: [PATCH] NRV related miscompilation

Jason Merrill jason@redhat.com
Thu Jul 11 14:16:00 GMT 2002


The following reply was made to PR c++/7280; it has been noted by GNATS.

From: Jason Merrill <jason@redhat.com>
To: gcc-bugs@gcc.gnu.org
Cc: jakub@redhat.com, gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: c++/7280: [PATCH] NRV related miscompilation
Date: Thu, 11 Jul 2002 22:11:19 +0100

 --=-=-=
 
 The bug was that we were failing to put the new variable in the stack
 because we didn't copy TREE_ADDRESSABLE.
 
 Tested i686-pc-linux-gnu, applied trunk and 3.1.
 
 2002-07-11  Jason Merrill  <jason@redhat.com>
 
 	PR c++/7279
 	* tree.c (cp_copy_res_decl_for_inlining): Also copy
 	TREE_ADDRESSABLE.
 
 
 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: inline
 
 *** tree.c.~1~	Thu Jul  4 16:08:15 2002
 --- tree.c	Thu Jul 11 20:16:15 2002
 *************** cp_copy_res_decl_for_inlining (result, f
 *** 2292,2298 ****
 --- 2292,2302 ----
   	  DECL_SOURCE_FILE (var) = DECL_SOURCE_FILE (nrv);
   	  DECL_SOURCE_LINE (var) = DECL_SOURCE_LINE (nrv);
   	  DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
 + 	  /* Don't lose initialization info.  */
   	  DECL_INITIAL (var) = DECL_INITIAL (nrv);
 + 	  /* Don't forget that it needs to go in the stack.  */
 + 	  TREE_ADDRESSABLE (var) = TREE_ADDRESSABLE (nrv);
 + 
   	  splay_tree_insert (decl_map,
   			     (splay_tree_key) nrv,
   			     (splay_tree_value) var);
 
 --=-=-=--



More information about the Gcc-prs mailing list