PATCH to array_type_nelts

Mark Mitchell mark@codesourcery.com
Thu Aug 26 20:05:00 GMT 1999


I committed the attached patch as an "obvious fix".  It doesn't make
sense to pull the SAVE_EXPR_RTL out of a SAVE_EXPR if it hasn't yet
been expanded.  Most other places (like fold-const) that manipulate
SAVE_EXPRs check to see that they have been expanded, and we need to
do so here as well to handle variable-sized arrays correctly in C++.

Bootstrapped and checked on i686-pc-linux-gnu.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-08-26  Mark Mitchell  <mark@codesourcery.com>

	* tree.c (copy_node): Improve documentation.
	(array_type_nelts): Don't return a value.

Index: tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tree.c,v
retrieving revision 1.74
diff -c -p -r1.74 tree.c
*** tree.c	1999/08/26 20:47:17	1.74
--- tree.c	1999/08/27 01:03:37
*************** make_node (code)
*** 1127,1134 ****
    return t;
  }
  
! /* Return a new node with the same contents as NODE
!    except that its TREE_CHAIN is zero and it has a fresh uid.  */
  
  tree
  copy_node (node)
--- 1127,1137 ----
    return t;
  }
  
! /* Return a new node with the same contents as NODE except that its
!    TREE_CHAIN is zero and it has a fresh uid.  Unlike make_node, this
!    function always performs the allocation on the CURRENT_OBSTACK;
!    it's up to the caller to pick the right obstack before calling this
!    function.  */
  
  tree
  copy_node (node)
*************** array_type_nelts (type)
*** 2244,2250 ****
    if (! TREE_CONSTANT (min))
      {
        STRIP_NOPS (min);
!       if (TREE_CODE (min) == SAVE_EXPR)
  	min = build (RTL_EXPR, TREE_TYPE (TYPE_MIN_VALUE (index_type)), 0,
  		     SAVE_EXPR_RTL (min));
        else
--- 2247,2253 ----
    if (! TREE_CONSTANT (min))
      {
        STRIP_NOPS (min);
!       if (TREE_CODE (min) == SAVE_EXPR && SAVE_EXPR_RTL (min))
  	min = build (RTL_EXPR, TREE_TYPE (TYPE_MIN_VALUE (index_type)), 0,
  		     SAVE_EXPR_RTL (min));
        else
*************** array_type_nelts (type)
*** 2254,2260 ****
    if (! TREE_CONSTANT (max))
      {
        STRIP_NOPS (max);
!       if (TREE_CODE (max) == SAVE_EXPR)
  	max = build (RTL_EXPR, TREE_TYPE (TYPE_MAX_VALUE (index_type)), 0,
  		     SAVE_EXPR_RTL (max));
        else
--- 2257,2263 ----
    if (! TREE_CONSTANT (max))
      {
        STRIP_NOPS (max);
!       if (TREE_CODE (max) == SAVE_EXPR && SAVE_EXPR_RTL (max))
  	max = build (RTL_EXPR, TREE_TYPE (TYPE_MAX_VALUE (index_type)), 0,
  		     SAVE_EXPR_RTL (max));
        else


More information about the Gcc-patches mailing list