From 77ed39034fda4f949fea955bfadbdab36df5d94a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 9 Oct 2014 08:21:46 +0000 Subject: [PATCH] re PR lto/61969 (wrong code by LTO on i?86-linux-gnu (affecting trunk, 4.9.x, and 4.8.x)) 2014-10-09 Richard Biener PR tree-optimization/61969 * tree-nrv.c (pass_nrv::execute): Properly test for automatic variables. From-SVN: r216029 --- gcc/ChangeLog | 6 ++++++ gcc/tree-nrv.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8b9f3019a8..3267a7a79ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-10-08 Richard Biener + + PR tree-optimization/61969 + * tree-nrv.c (pass_nrv::execute): Properly test for automatic + variables. + 2014-10-09 Richard Biener PR tree-optimization/63445 diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index f2f3147af36..02a4af9e681 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -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, -- 2.30.2