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]

Don't force BLKmode for zero-sized BLKmode field


This loosens up the code that forces record to BLKmode a bit in the
case when we have a BLKmode field but it's of zero-sized.  Making that
change requires one more fix to 0-sized component extraction.  This is
useful for allowing more representation clauses for Ada.

Tested on i686-pc-linux-gnu.

2003-10-10  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* stor-layout.c (compute_record_mode): Don't force BLKmode if
	field is zero-length BLKmode.
	* expr.c (expand_expr, case COMPONENT_REF): Handle case of BLKmode
	zero-size references.

*** expr.c	7 Oct 2003 07:25:32 -0000	1.592
--- expr.c	9 Oct 2003 21:10:35 -0000
*************** expand_expr (tree exp, rtx target, enum 
*** 7224,7227 ****
--- 7224,7233 ----
  	    if (ext_mode == BLKmode)
  	      {
+ 		if (target == 0)
+ 		  target = assign_temp (type, 0, 1, 1);
+ 
+ 		if (bitsize == 0)
+ 		  return target;
+ 
  		/* In this case, BITPOS must start at a byte boundary and
  		   TARGET, if specified, must be a MEM.  */
*************** expand_expr (tree exp, rtx target, enum 
*** 7231,7239 ****
  		  abort ();
  
! 		op0 = adjust_address (op0, VOIDmode, bitpos / BITS_PER_UNIT);
! 		if (target == 0)
! 		  target = assign_temp (type, 0, 1, 1);
! 
! 		emit_block_move (target, op0,
  				 GEN_INT ((bitsize + BITS_PER_UNIT - 1)
  					  / BITS_PER_UNIT),
--- 7237,7243 ----
  		  abort ();
  
! 		emit_block_move (target,
! 				 adjust_address (op0, VOIDmode,
! 						 bitpos / BITS_PER_UNIT),
  				 GEN_INT ((bitsize + BITS_PER_UNIT - 1)
  					  / BITS_PER_UNIT),
*** stor-layout.c	21 Sep 2003 05:07:10 -0000	1.168
--- stor-layout.c	9 Oct 2003 21:10:38 -0000
*************** compute_record_mode (tree type)
*** 1319,1323 ****
        if (TREE_CODE (TREE_TYPE (field)) == ERROR_MARK
  	  || (TYPE_MODE (TREE_TYPE (field)) == BLKmode
! 	      && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)))
  	  || ! host_integerp (bit_position (field), 1)
  	  || DECL_SIZE (field) == 0
--- 1319,1325 ----
        if (TREE_CODE (TREE_TYPE (field)) == ERROR_MARK
  	  || (TYPE_MODE (TREE_TYPE (field)) == BLKmode
! 	      && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field))
! 	      && !(TYPE_SIZE (TREE_TYPE (field)) != 0
! 		   && integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
  	  || ! host_integerp (bit_position (field), 1)
  	  || DECL_SIZE (field) == 0


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