diff options
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 |