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: [PATCH][4.1] Fix PR tree-optimization/26587, wrong PT alias information


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;
      }


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