This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/32461] [4.3 Regression] Segmentation fault in build_classic_dist_vector_1() at tree-data-ref.c:2700
- From: "richard dot guenther at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jun 2007 11:40:07 -0000
- Subject: [Bug tree-optimization/32461] [4.3 Regression] Segmentation fault in build_classic_dist_vector_1() at tree-data-ref.c:2700
- References: <bug-32461-13856@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #20 from richard dot guenther at gmail dot com 2007-06-24 11:40 -------
Subject: Re: [4.3 Regression] Segmentation fault in
build_classic_dist_vector_1() at tree-data-ref.c:2700
On 6/24/07, Sebastian Pop <sebpop@gmail.com> wrote:
> On 6/24/07, Sebastian Pop <spop@gcc.gnu.org> wrote:
> > Unfortunately I haven't seen the suggestion of Håkan Hjort to also
> > implement the fold of ~a + a ==> ~0. I could add a new patch for this
> > one too in the next bootstrap if the current patch still has issues.
> >
>
> I just realized that we already implement this:
> /* ~X + X is -1. */
> /* X + ~X is -1. */
>
> But, in our case, when we arrive at this point, it is useless because
> it uses operand_equal_p, so the above test fails, and we don't enter
> that code:
>
> /* ~X + X is -1. */
> if (TREE_CODE (arg0) == BIT_NOT_EXPR
> && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)
> && !TYPE_OVERFLOW_TRAPS (type))
> {
> t1 = build_int_cst_type (type, -1);
> return omit_one_operand (type, t1, arg1);
> }
If you use TREE_OPERAND (op0, 0), op1 instead it should work. The
problem seems to be that arg0/arg1 have all NOPs stripped, including
those changing the sign. So we get to compare a and (unsigned)a,
which are obviously not the same.
It looks like most of the users of the arg variants are suspicious in this
regard...
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32461