From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] operand_equal_p checking (PR sanitizer/70683)
Date: Wed, 27 Apr 2016 12:41:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1604271440550.13384@t29.fhfr.qr> (raw)
In-Reply-To: <20160426225139.GZ26501@tucnak.zalov.cz>
On Wed, 27 Apr 2016, Jakub Jelinek wrote:
> On Tue, Apr 26, 2016 at 03:02:38PM +0200, Jakub Jelinek wrote:
> > The debugging hack is too ugly and slows down the compiler (by artificially
> > increasing number of collisions), so it is not appropriate, but perhaps we
> > can add some internal only use OEP_* flag, pass it to the recursive calls
> > of operand_equal_p and if not set and flag_checking, verify
> > iterative_hash_expr equality in the outermost call).
>
> Here is the corresponding checking patch. It uncovered two further issues
> in the tree.[ch] patch which I'm going to post momentarily.
> Both patches together bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
Ok.
Thanks,
Richard.
> 2016-04-27 Jakub Jelinek <jakub@redhat.com>
>
> 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.
>
> --- gcc/tree-core.h.jj 2016-04-22 18:21:55.000000000 +0200
> +++ gcc/tree-core.h 2016-04-26 17:47:19.875753297 +0200
> @@ -765,7 +765,9 @@ enum operand_equal_flag {
> OEP_ONLY_CONST = 1,
> OEP_PURE_SAME = 2,
> OEP_MATCH_SIDE_EFFECTS = 4,
> - OEP_ADDRESS_OF = 8
> + OEP_ADDRESS_OF = 8,
> + /* Internal within operand_equal_p: */
> + OEP_NO_HASH_CHECK = 16
> };
>
> /* Enum and arrays used for tree allocation stats.
> --- gcc/fold-const.c.jj 2016-04-22 18:21:32.000000000 +0200
> +++ gcc/fold-const.c 2016-04-26 18:30:40.919080701 +0200
> @@ -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
>
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
next prev parent reply other threads:[~2016-04-27 12:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 13:02 [PATCH] Fix up inchash::add_expr to match more closely operand_equal_p " Jakub Jelinek
2016-04-26 22:51 ` [PATCH] operand_equal_p checking " Jakub Jelinek
2016-04-27 12:41 ` Richard Biener [this message]
2016-04-28 8:59 ` Christophe Lyon
2016-04-26 23:00 ` [PATCH] Fix up inchash::add_expr to match more closely operand_equal_p (PR sanitizer/70683, take 2) Jakub Jelinek
2016-04-27 7:41 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.11.1604271440550.13384@t29.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).