diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-06-14 17:27:24 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-06-14 17:27:24 +0200 |
commit | 1ace6185d22d5e23cf3fae342b9b48d18caad644 (patch) | |
tree | a038a08891c77147df8061be5e5979cdc97b4947 /gcc/cfgexpand.c | |
parent | 6b14c6d7ffc25b92aeea21f0c0c050582d3ed771 (diff) | |
download | gcc-1ace6185d22d5e23cf3fae342b9b48d18caad644.zip gcc-1ace6185d22d5e23cf3fae342b9b48d18caad644.tar.gz gcc-1ace6185d22d5e23cf3fae342b9b48d18caad644.tar.bz2 |
re PR fortran/49103 (local variables exchange values / wrong code with -O3)
PR fortran/49103
* tree.h (DECL_NONSHAREABLE): Define.
(struct tree_decl_common): Change decl_common_unused to
decl_nonshareable_flag.
* cfgexpand.c (expand_used_vars_for_block, clear_tree_used):
Ignore vars with DECL_NONSHAREABLE bit set.
* tree-cfg.c (gimple_duplicate_bb): Set DECL_NONSHAREABLE
on stores to automatic aggregate vars.
* gfortran.dg/pr49103.f90: New test.
From-SVN: r175028
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index b22ba71..491c2fc 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1098,7 +1098,9 @@ expand_used_vars_for_block (tree block, bool toplevel) /* Expand all variables at this level. */ for (t = BLOCK_VARS (block); t ; t = DECL_CHAIN (t)) - if (TREE_USED (t)) + if (TREE_USED (t) + && ((TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != RESULT_DECL) + || !DECL_NONSHAREABLE (t))) expand_one_var (t, toplevel, true); this_sv_num = stack_vars_num; @@ -1131,6 +1133,8 @@ clear_tree_used (tree block) for (t = BLOCK_VARS (block); t ; t = DECL_CHAIN (t)) /* if (!TREE_STATIC (t) && !DECL_EXTERNAL (t)) */ + if ((TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != RESULT_DECL) + || !DECL_NONSHAREABLE (t)) TREE_USED (t) = 0; for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t)) |