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]

Latent bug exposed by alignment changes


There is a bug in store_constructor in the way it handles alignment.
The following fixes it.  This fixes some compilation testsuite
failures on Alpha: hopefully it will fix the execution ones on
other machines.

Thu Mar 30 06:32:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* expr.c (store_constructor): Properly compute displacement and
	alignment when offset is variable.

*** expr.c	2000/03/30 18:17:19	1.226
--- expr.c	2000/03/30 22:11:05
*************** store_constructor (exp, target, align, c
*** 4245,4254 ****
  
  	      if (contains_placeholder_p (offset))
! 		offset = build (WITH_RECORD_EXPR, bitsizetype,
  				offset, make_tree (TREE_TYPE (exp), target));
  
- 	      offset = size_binop (EXACT_DIV_EXPR, offset, bitsize_unit_node);
- 	      offset = convert (sizetype, offset);
- 
  	      offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
  	      if (GET_CODE (to_rtx) != MEM)
--- 4245,4251 ----
  
  	      if (contains_placeholder_p (offset))
! 		offset = build (WITH_RECORD_EXPR, sizetype,
  				offset, make_tree (TREE_TYPE (exp), target));
  
  	      offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
  	      if (GET_CODE (to_rtx) != MEM)
*************** store_constructor (exp, target, align, c
*** 4269,4272 ****
--- 4266,4270 ----
  						force_reg (ptr_mode,
  							   offset_rtx)));
+ 	      align = DECL_OFFSET_ALIGN (field);
  	    }
  
*************** store_constructor (exp, target, align, c
*** 4307,4314 ****
  #endif
  	  store_constructor_field (to_rtx, bitsize, bitpos, mode,
! 				   TREE_VALUE (elt), type, 
! 				   MIN (align,
! 					DECL_ALIGN (TREE_PURPOSE (elt))),
! 				   cleared);
  	}
      }
--- 4305,4309 ----
  #endif
  	  store_constructor_field (to_rtx, bitsize, bitpos, mode,
! 				   TREE_VALUE (elt), type, align, cleared);
  	}
      }

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