This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix type mismatch in building ADDR_EXPR
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 19 May 2005 11:02:33 +0200 (CEST)
- Subject: Re: [PATCH] Fix type mismatch in building ADDR_EXPR
On Wed, 18 May 2005, Zdenek Dvorak wrote:
> Hello,
>
> > Number one. Looks obvious, will apply at the end of the week
> > if nobody objects and bootstrap & regtest succeeds.
>
> there is a small problem with the patch -- you need to convert the
> result to ptr_type_node.
>
> Zdenek
This is what was bootstrapped and regtested successfully on
x86_64-unknown-linux-gnu for all languages but ada.
Richard.
2005-05-18 Richard Guenther <rguenth@gcc.gnu.org>
* tree-ssa-loop-ivopts.c (determine_base_object): Use
build_fold_addr_expr to generate trees of correct type.
Use fold_buildN if possible.
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.70
diff -c -3 -p -r2.70 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c 17 May 2005 20:02:56 -0000 2.70
--- tree-ssa-loop-ivopts.c 18 May 2005 11:28:24 -0000
*************** determine_base_object (tree expr)
*** 791,797 ****
if (TREE_CODE (base) == INDIRECT_REF)
return determine_base_object (TREE_OPERAND (base, 0));
! return fold (build1 (ADDR_EXPR, ptr_type_node, base));
case PLUS_EXPR:
case MINUS_EXPR:
--- 791,798 ----
if (TREE_CODE (base) == INDIRECT_REF)
return determine_base_object (TREE_OPERAND (base, 0));
! return fold_convert (ptr_type_node,
! build_fold_addr_expr (base));
case PLUS_EXPR:
case MINUS_EXPR:
*************** determine_base_object (tree expr)
*** 804,812 ****
if (!op0)
return (code == PLUS_EXPR
? op1
! : fold (build1 (NEGATE_EXPR, ptr_type_node, op1)));
! return fold (build (code, ptr_type_node, op0, op1));
case NOP_EXPR:
case CONVERT_EXPR:
--- 805,813 ----
if (!op0)
return (code == PLUS_EXPR
? op1
! : fold_build1 (NEGATE_EXPR, ptr_type_node, op1));
! return fold_build2 (code, ptr_type_node, op0, op1);
case NOP_EXPR:
case CONVERT_EXPR: