diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-04-27 15:29:34 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-04-27 15:29:34 +0200 |
commit | b3b2bae4e2a40ede680da463415bf8e4e885b93e (patch) | |
tree | 0b2a2bd79d40fa89ffbdf39a837fd4e5a09c14ce /gcc/fold-const.c | |
parent | 3c98ff9b1a24246e19da39fce967fe2f88be828e (diff) | |
download | gcc-b3b2bae4e2a40ede680da463415bf8e4e885b93e.zip gcc-b3b2bae4e2a40ede680da463415bf8e4e885b93e.tar.gz gcc-b3b2bae4e2a40ede680da463415bf8e4e885b93e.tar.bz2 |
re PR sanitizer/70683 (-fcompare-debug bug with -fsanitize=address)
PR sanitizer/70683
* tree-core.h (enum operand_equal_flag): Add OEP_NO_HASH_CHECK.
* fold-const.c (operand_equal_p): If flag_checking and
OEP_NO_HASH_CHECK is not set in flag, recurse with OEP_NO_HASH_CHECK
and if it returns non-zero, assert iterative_hash_expr on both
args is the same.
From-SVN: r235507
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1ce66e7..7fc23c6 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2749,6 +2749,25 @@ combine_comparisons (location_t loc, int operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) { + /* When checking, verify at the outermost operand_equal_p call that + if operand_equal_p returns non-zero then ARG0 and ARG1 has the same + hash value. */ + if (flag_checking && !(flags & OEP_NO_HASH_CHECK)) + { + if (operand_equal_p (arg0, arg1, flags | OEP_NO_HASH_CHECK)) + { + inchash::hash hstate0 (0), hstate1 (0); + inchash::add_expr (arg0, hstate0, flags); + inchash::add_expr (arg1, hstate1, flags); + hashval_t h0 = hstate0.end (); + hashval_t h1 = hstate1.end (); + gcc_assert (h0 == h1); + return 1; + } + else + return 0; + } + /* If either is ERROR_MARK, they aren't equal. */ if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK || TREE_TYPE (arg0) == error_mark_node |