diff options
author | James E Wilson <wilson@specifixinc.com> | 2004-09-03 22:33:46 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 2004-09-03 15:33:46 -0700 |
commit | bb1058e4c2866efcfb59d127081e6afceaa16fd8 (patch) | |
tree | 88df64db6e96a587e3283bf6ab62e3fe58be7ff4 | |
parent | ca83de6b3332b3647bfd4bda0b88e5ed258e81f9 (diff) | |
download | gcc-bb1058e4c2866efcfb59d127081e6afceaa16fd8.zip gcc-bb1058e4c2866efcfb59d127081e6afceaa16fd8.tar.gz gcc-bb1058e4c2866efcfb59d127081e6afceaa16fd8.tar.bz2 |
Fix aliasing bug that also caused memory usage problems.
* tree-ssa-alias.c (may_be_aliased): Move TREE_STATIC check after
DECL_EXTERNAL check.
From-SVN: r87057
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 175598c..a8fbba5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-03 James E Wilson <wilson@specifixinc.com> + + * tree-ssa-alias.c (may_be_aliased): Move TREE_STATIC check after + DECL_EXTERNAL check. + 2004-09-03 Eric Botcazou <ebotcazou@libertysurf.fr> * final.c (output_in_slot): New global variable. diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 25c7cf0..4027ec9 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2467,15 +2467,17 @@ may_be_aliased (tree var) if (TREE_ADDRESSABLE (var)) return true; - /* Automatic variables can't have their addresses escape any other way. */ - if (!TREE_STATIC (var)) - return false; - /* Globally visible variables can have their addresses taken by other translation units. */ if (DECL_EXTERNAL (var) || TREE_PUBLIC (var)) return true; + /* Automatic variables can't have their addresses escape any other way. + This must be after the check for global variables, as extern declarations + do not have TREE_STATIC set. */ + if (!TREE_STATIC (var)) + return false; + /* If we're in unit-at-a-time mode, then we must have seen all occurrences of address-of operators, and so we can trust TREE_ADDRESSABLE. Otherwise we can only be sure the variable isn't addressable if it's local to the |