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 16681


This is the version I installed on 3.3 and 3.4 branches.  The only
difference is a 'build' rather than a 'build2' call, and no change
to tree-inline.c

booted & tested on i686-pc-linux-gnu.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-12-09  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/16681
	* init.c (build_zero_init): Build a RANGE_EXPR for an array
	initializer.

Index: cp/init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/init.c,v
retrieving revision 1.299.2.18
diff -c -3 -p -r1.299.2.18 init.c
*** cp/init.c	28 Jul 2004 02:17:28 -0000	1.299.2.18
--- cp/init.c	9 Dec 2004 14:59:26 -0000
*************** build_zero_init (tree type, tree nelts, 
*** 235,241 ****
      }
    else if (TREE_CODE (type) == ARRAY_TYPE)
      {
-       tree index;
        tree max_index;
        tree inits;
  
--- 235,240 ----
*************** build_zero_init (tree type, tree nelts, 
*** 249,263 ****
        /* A zero-sized array, which is accepted as an extension, will
           have an upper bound of -1.  */
        if (!tree_int_cst_equal (max_index, integer_minus_one_node))
!         for (index = size_zero_node;
!              !tree_int_cst_lt (max_index, index);
!              index = size_binop (PLUS_EXPR, index, size_one_node))
!           inits = tree_cons (index,
!                              build_zero_init (TREE_TYPE (type),
!                                               /*nelts=*/NULL_TREE,
!                                               static_storage_p),
!                              inits);
!          CONSTRUCTOR_ELTS (init) = nreverse (inits);
      }
    else if (TREE_CODE (type) == REFERENCE_TYPE)
      ;
--- 248,264 ----
        /* A zero-sized array, which is accepted as an extension, will
           have an upper bound of -1.  */
        if (!tree_int_cst_equal (max_index, integer_minus_one_node))
!  	{
!  	  tree elt_init = build_zero_init (TREE_TYPE (type),
!  					   /*nelts=*/NULL_TREE,
!  					   static_storage_p);
!  	  tree range = build (RANGE_EXPR,
! 			      sizetype, size_zero_node, max_index);
!  	  
!  	  inits = tree_cons (range, elt_init, inits);
!  	}
!        
!       CONSTRUCTOR_ELTS (init) = nreverse (inits);
      }
    else if (TREE_CODE (type) == REFERENCE_TYPE)
      ;

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