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]

Patch to expand_decl


Fixes all the g++ testcases that use dynamic arrays.  It used to be that
when we parsed the declaration, we would call variable_size, which would
expand the SAVE_EXPR we generated for the upper bound.  But in
function-at-a-time mode we can't do that; we need to defer it until we
expand the declaration of the declaration itself.

1999-12-15  Jason Merrill  <jason@casey.cygnus.com>

	* stmt.c (expand_decl): Expand upper bound of a dynamic array.

Index: stmt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stmt.c,v
retrieving revision 1.111
diff -c -p -r1.111 stmt.c
*** stmt.c	1999/12/12 18:32:36	1.111
--- stmt.c	1999/12/15 19:47:59
*************** expand_decl (decl)
*** 3817,3822 ****
--- 3817,3828 ----
  	  stack_block_stack = thisblock;
  	}
  
+       /* In function-at-a-time mode, variable_size doesn't expand this,
+ 	 so do it now.  */
+       if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
+ 	expand_expr (TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
+ 		     const0_rtx, VOIDmode, 0);
+ 
        /* Compute the variable's size, in bytes.  */
        size = expand_expr (size_binop (CEIL_DIV_EXPR,
  				      DECL_SIZE (decl),


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