re PR lto/61969 (wrong code by LTO on i?86-linux-gnu (affecting trunk, 4.9.x, and...
authorRichard Biener <rguenther@suse.de>
Thu, 9 Oct 2014 08:21:46 +0000 (08:21 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 9 Oct 2014 08:21:46 +0000 (08:21 +0000)
2014-10-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/61969
* tree-nrv.c (pass_nrv::execute): Properly test for automatic
variables.

From-SVN: r216029

gcc/ChangeLog
gcc/tree-nrv.c

index b8b9f3019a802d44b337f3215fce93dc39173beb..3267a7a79bab880a5b113232ddbc6d35216e3b56 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-08  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61969
+       * tree-nrv.c (pass_nrv::execute): Properly test for automatic
+       variables.
+
 2014-10-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/63445
index f2f3147af365ff85c9732aa3eb35e11d64675c52..02a4af9e6818cb8483c51ddfa6fc372d7b3a908e 100644 (file)
@@ -216,8 +216,7 @@ pass_nrv::execute (function *fun)
                 same type and alignment as the function's result.  */
              if (TREE_CODE (found) != VAR_DECL
                  || TREE_THIS_VOLATILE (found)
-                 || DECL_CONTEXT (found) != current_function_decl
-                 || TREE_STATIC (found)
+                 || !auto_var_in_fn_p (found, current_function_decl)
                  || TREE_ADDRESSABLE (found)
                  || DECL_ALIGN (found) > DECL_ALIGN (result)
                  || !useless_type_conversion_p (result_type,