------- Comment #7 from rguenth at gcc dot gnu dot org  2010-07-23 11:40 -------
Hm, no.  I think tree-nrv.c is correct.  I was playing with

Index: gcc/tree-nrv.c
===================================================================
--- gcc/tree-nrv.c      (revision 162450)
+++ gcc/tree-nrv.c      (working copy)
@@ -310,7 +310,8 @@ dest_safe_for_nrv_p (gimple call)
   if (TREE_CODE (dest) == SSA_NAME)
     return true;

-  if (call_may_clobber_ref_p (call, dest))
+  if (call_may_clobber_ref_p (call, dest)
+      || ref_maybe_used_by_stmt_p (call, dest))
     return false;

   return true;


but that's overly restrictive for something that is undefined even on the
gimple level.

Joseph, this is really triggering undefined behavior in C, does it?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot org


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

Reply via email to