diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-12-10 00:28:01 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-12-09 23:28:01 +0000 |
commit | 54363f8a92920f5559c83ddd53e480a27205e6b7 (patch) | |
tree | 8ef2dd128c31080dac218b7c43d96a8c2b68c98a /gcc/tree-ssa-alias.c | |
parent | da20571a7c2a7e44ccd5999356b1131f9aa6b2de (diff) | |
download | gcc-54363f8a92920f5559c83ddd53e480a27205e6b7.zip gcc-54363f8a92920f5559c83ddd53e480a27205e6b7.tar.gz gcc-54363f8a92920f5559c83ddd53e480a27205e6b7.tar.bz2 |
re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886
PR middle-end/25140
* tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Use compare_base_decls
(nonoverlapping_component_refs_of_decl_p): Update sanity check.
(decl_refs_may_alias_p): Use compare_base_decls.
* alias.c: Include cgraph.h
(rtx_equal_for_memref_p): Use rtx_equal_for_memref_p.
(compare_base_decls): New function.
(base_alias_check): Likewise.
(memrefs_conflict_p): Likewise.
(nonoverlapping_memrefs_p): Likewise.
* alias.h (compare_base_decls): Declare.
* gcc.c-torture/execute/alias-2.c: New testcase.
From-SVN: r231478
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 b0ab6fb..b516546 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -194,7 +194,7 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) ptr = TREE_OPERAND (base, 0); else if (base && DECL_P (base)) - return base == decl; + return compare_base_decls (base, decl) != 0; else if (base && CONSTANT_CLASS_P (base)) return false; @@ -805,8 +805,10 @@ nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2) ref2 = TREE_OPERAND (TREE_OPERAND (ref2, 0), 0); } - /* We must have the same base DECL. */ - gcc_assert (ref1 == ref2); + /* Bases must be either same or uncomparable. */ + gcc_checking_assert (ref1 == ref2 + || (DECL_P (ref1) && DECL_P (ref2) + && compare_base_decls (ref1, ref2) != 0)); /* Pop the stacks in parallel and examine the COMPONENT_REFs of the same rank. This is sufficient because we start from the same DECL and you @@ -989,7 +991,7 @@ decl_refs_may_alias_p (tree ref1, tree base1, gcc_checking_assert (DECL_P (base1) && DECL_P (base2)); /* If both references are based on different variables, they cannot alias. */ - if (base1 != base2) + if (compare_base_decls (base1, base2) == 0) return false; /* If both references are based on the same variable, they cannot alias if |