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]

COND_EXPR folding patch


Fixes g++.law/refs4.C; recent changes to strip cv-quals from non-class
rvalues in C++ caused us to wrap the MIN_EXPR in a NOP_EXPR, defeating
the unary_complex_lvalue transformation.

2000-06-05  Jason Merrill  <jason@casey.soma.redhat.com>

	* fold-const.c (fold, case COND_EXPR): Elide conversion between
	cv-qualified versions of types.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fold-const.c,v
retrieving revision 1.120
diff -c -p -r1.120 fold-const.c
*** fold-const.c	2000/05/31 11:55:53	1.120
--- fold-const.c	2000/06/05 23:56:01
*************** fold (expr) 
*** 6903,6908 ****
--- 6903,6912 ----
  	      tree comp_op1 = TREE_OPERAND (arg0, 1);
  	      tree comp_type = TREE_TYPE (comp_op0);
  
+ 	      /* Avoid adding NOP_EXPRs in case this is an lvalue.  */
+ 	      if (TYPE_MAIN_VARIANT (comp_type) == TYPE_MAIN_VARIANT (type))
+ 		comp_type = type;
+ 
  	      switch (comp_code)
  		{
  		case EQ_EXPR:

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