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] Fix PR tree-optimization/24172


I take that back.  I have a testcase that with the patch ICEs:

evaluatorTest2ui.cpp: In member function âvoid 
ContiguousMapper<Dim>::map(const std::vector<Node<Interval<Dim>, 
Interval<Dim> >*, std::allocator<Node<Interval<Dim>, Interval<Dim> >*> >&) 
const [with int Dim = 2]â:
evaluatorTest2ui.cpp:4682: internal compiler error: in copy_body_r, at 
tree-inline.c:658

so simply falling through to copying does not work.  Honza, can you
look at this?

Thanks,
Richard.

On Wed, 5 Oct 2005, Richard Guenther wrote:

> On Tue, 4 Oct 2005, Richard Henderson wrote:
> 
> > On Tue, Oct 04, 2005 at 05:47:12PM +0200, Richard Guenther wrote:
> > > !             /* Fall through to copying the folded tree.  */
> > 
> > Yes, this looks plausible.
> 
> I re-bootstrapped and tested the following combined patch.
> 
> Ok for mainline?
> 
> Thanks,
> Richard.
> 
> 2005-10-05  Richard Guenther  <rguenther@suse.de>
> 
> 	PR tree-optimization/24172
> 	* fold-const.c (fold_indirect_ref_1): Make sure we fold
> 	ARRAY_REFs of constant strings.
> 	* tree-inline.c (copy_body_r): Copy folded trees.
> 
> 	* g++.dg/tree-ssa/pr24172.C: New testcase.
> 
> 
> Index: fold-const.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
> retrieving revision 1.626
> diff -c -3 -p -r1.626 fold-const.c
> *** fold-const.c	26 Sep 2005 01:28:38 -0000	1.626
> --- fold-const.c	4 Oct 2005 10:59:06 -0000
> *************** fold_indirect_ref_1 (tree type, tree op0
> *** 11511,11519 ****
>       {
>         tree op = TREE_OPERAND (sub, 0);
>         tree optype = TREE_TYPE (op);
> !       /* *&p => p */
>         if (type == optype)
> ! 	return op;
>         /* *(foo *)&fooarray => fooarray[0] */
>         else if (TREE_CODE (optype) == ARRAY_TYPE
>   	       && type == TREE_TYPE (optype))
> --- 11511,11525 ----
>       {
>         tree op = TREE_OPERAND (sub, 0);
>         tree optype = TREE_TYPE (op);
> !       /* *&p => p;  make sure to handle *&"str"[cst] here.  */
>         if (type == optype)
> ! 	{
> ! 	  tree fop = fold_read_from_constant_string (op);
> ! 	  if (fop)
> ! 	    return fop;
> ! 	  else
> ! 	    return op;
> ! 	}
>         /* *(foo *)&fooarray => fooarray[0] */
>         else if (TREE_CODE (optype) == ARRAY_TYPE
>   	       && type == TREE_TYPE (optype))
> Index: tree-inline.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
> retrieving revision 1.210
> diff -c -3 -p -r1.210 tree-inline.c
> *** tree-inline.c	1 Aug 2005 15:25:28 -0000	1.210
> --- tree-inline.c	5 Oct 2005 08:58:55 -0000
> *************** copy_body_r (tree *tp, int *walk_subtree
> *** 636,643 ****
>   	          else
>   	            *tp = build1 (INDIRECT_REF, type, (tree)n->value);
>   		}
> ! 	      *walk_subtrees = 0;
> ! 	      return NULL;
>   	    }
>   	}
>   
> --- 636,642 ----
>   	          else
>   	            *tp = build1 (INDIRECT_REF, type, (tree)n->value);
>   		}
> ! 	      /* Fall through to copying the folded tree.  */
>   	    }
>   	}
>   
> 
> /* { dg-do compile } */
> /* { dg-options "-O2" } */
> 
> void IOException( char);
> inline int* dummy( const char* const mode )
> {
>   IOException(*mode+*mode);
> }
> 
> void prepare_inpaint( )
> {
>   dummy ("rb");
> }
> 
> 
> 


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