------- Comment #23 from richard dot guenther at gmail dot com 2007-06-24 12:59 ------- 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 <[EMAIL PROTECTED]> wrote: > On 6/24/07, Richard Guenther <[EMAIL PROTECTED]> wrote: > > 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. > > > > Right. > The attached patch solves the problem. > > > It looks like most of the users of the arg variants are suspicious in this > > regard... > > > > So if I'm correctly understanding, you suppose that there are also > other cases in which fold fails just because it uses arg instead of op? quite possibly. The patch is ok if it bootstraps & tests and you change /* X + ~X is -1. */ if (TREE_CODE (arg1) == BIT_NOT_EXPR - && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0) + && operand_equal_p (op0, TREE_OPERAND (op1, 0), 0) && !TYPE_OVERFLOW_TRAPS (type)) to use op1 to check against BIT_NOT_EXPR. An alternative is to use if (TREE_CODE (arg1) == BIT_NOT_EXPR && !TYPE_OVERFLOW_TRAPS (type)) { tem = TREE_OPERAND (arg1, 0); STRIP_NOPS (tem); if (operand_equal_p (arg0, tem, 0)) ... which would be even better and shouldn't cause other missed optimizations. Thanks, Richard. > Thanks, > Sebastian > > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32461