re PR tree-optimization/30590 (tree-nrv optimization clobbers return variable)
authorSeongbae Park <seongbae.park@gmail.com>
Wed, 14 Mar 2007 05:48:35 +0000 (05:48 +0000)
committerSeongbae Park <spark@gcc.gnu.org>
Wed, 14 Mar 2007 05:48:35 +0000 (05:48 +0000)
2007-03-13  Seongbae Park <seongbae.park@gmail.com>

PR tree-optimization/30590
* tree-nrv.c (tree_nrv): Check for the partial update of the
return value.

From-SVN: r122909

gcc/ChangeLog
gcc/tree-nrv.c

index 45d009d..1e5a199 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-13  Seongbae Park <seongbae.park@gmail.com>
+
+       PR tree-optimization/30590
+       * tree-nrv.c (tree_nrv): Check for the partial update of the
+       return value.
+
 2007-03-13  Alexandre Oliva  <aoliva@redhat.com>
 
        * flags.h (flag_random_seed): Remove declaration, in favor of...
index c33ff0e..906b98f 100644 (file)
@@ -163,6 +163,14 @@ tree_nrv (void)
                                                     result_type))
                return 0;
            }
+         else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+           {
+             tree addr = get_base_address (GIMPLE_STMT_OPERAND (stmt, 0));
+              /* If there's any MODIFY of component of RESULT, 
+                 then bail out.  */
+             if (addr && addr == result)
+               return 0;
+           }
        }
     }