This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][4.1] Fix PR tree-optimization/26587, wrong PT alias information
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Daniel Berlin <dberlin at dberlin dot org>
- Date: Tue, 7 Mar 2006 15:19:50 +0100 (CET)
- Subject: Re: [PATCH][4.1] Fix PR tree-optimization/26587, wrong PT alias information
- References: <Pine.LNX.4.63.0603071220500.27394@t148.fhfr.qr>
On Tue, 7 Mar 2006, Richard Guenther wrote:
>
> This patch fixes PR26587 where we create wrong PTA information which leads
> to wrong code later.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu,
>
> ok for 4.1 branch? A similar fix ok for 4.2 or do we want to do more
> interesting things with negative offsets there? (looks not so easy,
> because offsets are unsigned everywhere)
The following is a forward port of the patch to trunk.
Ok if bootstrap & regtest passes?
Thanks,
Richard.
2006-03-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/26587
* tree-ssa-structalias.c (handle_ptr_arith): Handle MINUS_EXPR.
* gcc.dg/torture/pr26587.c: New testcase.
Index: tree-ssa-structalias.c
===================================================================
*** tree-ssa-structalias.c (revision 111788)
--- tree-ssa-structalias.c (working copy)
*************** handle_ptr_arith (VEC (ce_s, heap) *lhsc
*** 3182,3188 ****
VEC (ce_s, heap) *temp = NULL;
unsigned int rhsoffset = 0;
! if (TREE_CODE (expr) != PLUS_EXPR)
return false;
op0 = TREE_OPERAND (expr, 0);
--- 3162,3169 ----
VEC (ce_s, heap) *temp = NULL;
unsigned int rhsoffset = 0;
! if (TREE_CODE (expr) != PLUS_EXPR
! && TREE_CODE (expr) != MINUS_EXPR)
return false;
op0 = TREE_OPERAND (expr, 0);
*************** handle_ptr_arith (VEC (ce_s, heap) *lhsc
*** 3190,3196 ****
get_constraint_for (op0, &temp);
if (POINTER_TYPE_P (TREE_TYPE (op0))
! && TREE_CODE (op1) == INTEGER_CST)
{
rhsoffset = TREE_INT_CST_LOW (op1) * BITS_PER_UNIT;
}
--- 3171,3178 ----
get_constraint_for (op0, &temp);
if (POINTER_TYPE_P (TREE_TYPE (op0))
! && TREE_CODE (op1) == INTEGER_CST
! && TREE_CODE (expr) == PLUS_EXPR)
{
rhsoffset = TREE_INT_CST_LOW (op1) * BITS_PER_UNIT;
}