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: 23 Jun 2007 19:24:25 -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 #10 from richard dot guenther at gmail dot com 2007-06-23 19:24 -------
Subject: Re: [4.3 Regression] Segmentation fault in
build_classic_dist_vector_1() at tree-data-ref.c:2700
On 6/23/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> On 6/23/07, Sebastian Pop <spop@gcc.gnu.org> wrote:
> > Hi,
> >
> > In data dependence analysis, when the dependence distance is
> > lexicographically negative, we recompute the dependence by inverting
> > the source and the sink memory accesses, and thus we compute the
> > dependence again but in the opposite direction. In one way we
> > compute:
> >
> > MINUS_EXPR
> > (unsigned int) i_434 + 1
> > (unsigned int) i_434
> > =
> > 1
> >
> > but when going the other way, backwards, we have to compute:
> >
> > MINUS_EXPR
> > (unsigned int) i_434
> > (unsigned int) i_434 + 1
> > =
> > ~(unsigned int) i_434 + (unsigned int) i_434
> >
> > and instead of getting an integer_cst, we get that ugly expression
> > from fold, the dependence test fails, and everything goes wrong from
> > that point.
> >
> > With this patch we get the expected 0xffffffffffffffff for the above
> > case. The patch teaches fold how to compute the minus expression for
> > unsigned int and pointer expressions.
> >
> > Bootstrapped and tested on i686-linux. Okay for trunk?
>
> First - can you check why the asociate: case in fold_binary does not do
> the transformation and maybe fix that instead if possible?
>
> Then there is a ChangeLog missing. Further...
>
> + && integer_zerop (fold_build2 (MINUS_EXPR, type, arg0,
> + TREE_OPERAND (arg1, 0))))
>
> to avoid creating trees and just throwing them away you should use
> operand_equal_p (arg0, TREE_OPERAND (arg1, 0)) instead. You
> similarly may want to check operand 1 for A - (B + A)?
>
> + && TYPE_UNSIGNED (type)
>
> you should check TYPE_OVERFLOW_WRAPS (type) instead.
Oh - and there is omit_two_operands which you should use to
omit the two As. This takes care of side-effects.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32461