This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug tree-optimization/32461] [4.3 Regression] Segmentation fault in build_classic_dist_vector_1() at tree-data-ref.c:2700


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.

Thanks,
Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]