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]

Re: g++ internal compiler error linux-i586 libstdc++-2.90.7


I'd prefer to fix put_var_into_stack.  This fixes your testcase:

2000-03-13  Jason Merrill  <jason@casey.cygnus.com>

	* function.c (put_var_into_stack): Use type_for_mode to calculate
	part_type.  Use MEM_SET_IN_STRUCT_P.
	* expr.c (store_field): Handle CONCAT.
	(store_constructor): Use fields_length.
	* tree.c (fields_length): New fn.
	* tree.h: Declare it.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.c,v
retrieving revision 1.212
diff -c -p -r1.212 expr.c
*** expr.c	2000/03/10 04:03:10	1.212
--- expr.c	2000/03/13 21:34:55
*************** store_constructor (exp, target, align, c
*** 4151,4157 ****
  	 clear the whole structure first.  */
        else if (size > 0
  	       && ((list_length (CONSTRUCTOR_ELTS (exp))
! 		    != list_length (TYPE_FIELDS (type)))
  		   || mostly_zeros_p (exp)))
  	{
  	  if (! cleared)
--- 4151,4157 ----
  	 clear the whole structure first.  */
        else if (size > 0
  	       && ((list_length (CONSTRUCTOR_ELTS (exp))
! 		    != fields_length (type))
  		   || mostly_zeros_p (exp)))
  	{
  	  if (! cleared)
*************** store_field (target, bitsize, bitpos, mo
*** 4756,4761 ****
--- 4756,4768 ----
        emit_move_insn (target, object);
  
        return blk_object;
+     }
+ 
+   if (GET_CODE (target) == CONCAT)
+     {
+       if (bitpos != 0)
+ 	abort ();
+       return store_expr (exp, target, 0);
      }
  
    /* If the structure is in a register or if the component
Index: function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.173
diff -c -p -r1.173 function.c
*** function.c	2000/03/09 19:01:47	1.173
--- function.c	2000/03/13 21:35:00
*************** put_var_into_stack (decl)
*** 1383,1389 ****
        /* A CONCAT contains two pseudos; put them both in the stack.
  	 We do it so they end up consecutive.  */
        enum machine_mode part_mode = GET_MODE (XEXP (reg, 0));
!       tree part_type = TREE_TYPE (TREE_TYPE (decl));
  #ifdef FRAME_GROWS_DOWNWARD
        /* Since part 0 should have a lower address, do it second.  */
        put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
--- 1383,1389 ----
        /* A CONCAT contains two pseudos; put them both in the stack.
  	 We do it so they end up consecutive.  */
        enum machine_mode part_mode = GET_MODE (XEXP (reg, 0));
!       tree part_type = type_for_mode (part_mode, 0);
  #ifdef FRAME_GROWS_DOWNWARD
        /* Since part 0 should have a lower address, do it second.  */
        put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
*************** put_var_into_stack (decl)
*** 1409,1414 ****
--- 1409,1415 ----
        PUT_CODE (reg, MEM);
        MEM_VOLATILE_P (reg) = MEM_VOLATILE_P (XEXP (reg, 0));
        MEM_ALIAS_SET (reg) = get_alias_set (decl);
+       MEM_SET_IN_STRUCT_P (reg, AGGREGATE_TYPE_P (TREE_TYPE (decl)));
  
        /* The two parts are in memory order already.
  	 Use the lower parts address as ours.  */
Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.c,v
retrieving revision 1.122
diff -c -p -r1.122 tree.c
*** tree.c	2000/03/09 20:34:50	1.122
--- tree.c	2000/03/13 21:35:08
*************** list_length (t)
*** 2004,2009 ****
--- 2004,2025 ----
    return len;
  }
  
+ /* Returns the number of FIELD_DECLs in TYPE.  */
+ 
+ int
+ fields_length (type)
+      tree type;
+ {
+   tree t = TYPE_FIELDS (type);
+   int count = 0;
+ 
+   for (; t; t = TREE_CHAIN (t))
+     if (TREE_CODE (t) == FIELD_DECL)
+       ++count;
+ 
+   return count;
+ }
+ 
  /* Concatenate two chains of nodes (chained through TREE_CHAIN)
     by modifying the last node in chain 1 to point to chain 2.
     This is the Lisp primitive `nconc'.  */
Index: tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.h,v
retrieving revision 1.141
diff -c -p -r1.141 tree.h
*** tree.h	2000/03/13 09:12:50	1.141
--- tree.h	2000/03/13 21:35:12
*************** tree.h			PARAMS ((tree));
*** 1930,1935 ****
--- 1930,1939 ----
  
  extern int list_length			PARAMS ((tree));
  
+ /* Returns the number of FIELD_DECLs in a type.  */
+ 
+ extern int fields_length		PARAMS ((tree));
+ 
  /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
  
  extern int integer_zerop		PARAMS ((tree));

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