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]

(C++) patch to array CONSTRUCTORs


A recent patch of Kenner's caused g++.mike/p700.C to fail with -O,
crashing in expand_expr because we never saw the desired index in a
TREE_PURPOSE of the CONSTRUCTOR.  This is bogus, but g++ should still
be setting TREE_PURPOSE.

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

	* typeck2.c (process_init_constructor): Set TREE_PURPOSE of
	array CONSTRUCTOR elements.  Don't use expr_tree_cons.

Index: typeck2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/typeck2.c,v
retrieving revision 1.79
diff -c -p -r1.79 typeck2.c
*** typeck2.c	2000/03/07 11:41:22	1.79
--- typeck2.c	2000/03/08 15:47:00
*************** process_init_constructor (type, init, el
*** 811,817 ****
  	    allconstant = 0;
  	  else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
  	    allsimple = 0;
! 	  members = expr_tree_cons (NULL_TREE, next1, members);
  	}
      }
    else if (TREE_CODE (type) == RECORD_TYPE)
--- 811,817 ----
  	    allconstant = 0;
  	  else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
  	    allsimple = 0;
! 	  members = tree_cons (size_int (i), next1, members);
  	}
      }
    else if (TREE_CODE (type) == RECORD_TYPE)
*************** process_init_constructor (type, init, el
*** 844,850 ****
  	{
  	  if (! DECL_NAME (field) && DECL_C_BIT_FIELD (field))
  	    {
! 	      members = expr_tree_cons (field, integer_zero_node, members);
  	      continue;
  	    }
  
--- 844,850 ----
  	{
  	  if (! DECL_NAME (field) && DECL_C_BIT_FIELD (field))
  	    {
! 	      members = tree_cons (field, integer_zero_node, members);
  	      continue;
  	    }
  
*************** process_init_constructor (type, init, el
*** 920,926 ****
  	    allconstant = 0;
  	  else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
  	    allsimple = 0;
! 	  members = expr_tree_cons (field, next1, members);
  	}
      }
    else if (TREE_CODE (type) == UNION_TYPE
--- 920,926 ----
  	    allconstant = 0;
  	  else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
  	    allsimple = 0;
! 	  members = tree_cons (field, next1, members);
  	}
      }
    else if (TREE_CODE (type) == UNION_TYPE
*************** process_init_constructor (type, init, el
*** 991,997 ****
  	allconstant = 0;
        else if (initializer_constant_valid_p (next1, TREE_TYPE (next1)) == 0)
  	allsimple = 0;
!       members = expr_tree_cons (field, next1, members);
      }
  
    /* If arguments were specified as a list, just remove the ones we used.  */
--- 991,997 ----
  	allconstant = 0;
        else if (initializer_constant_valid_p (next1, TREE_TYPE (next1)) == 0)
  	allsimple = 0;
!       members = tree_cons (field, next1, members);
      }
  
    /* If arguments were specified as a list, just remove the ones we used.  */

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