This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

expr.c tidy


Gets rid of some (buggy) duplicated code.

	* expr.c (expr): Simplify foo-foo here.
	(clean_up_expression): Remove O_subtract code.

Applying mainline.

Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.44
diff -u -p -r1.44 expr.c
--- gas/expr.c	19 Sep 2002 23:51:35 -0000	1.44
+++ gas/expr.c	20 Sep 2002 00:19:36 -0000
@@ -1347,8 +1347,6 @@ operand (expressionP)
 	Elsewise we waste time special-case testing. Sigh. Ditto SEG_ABSENT.
 
    Out:	expressionS may have been modified:
-	'foo-foo' symbol references cancelled to 0, which changes X_op
-	from O_subtract to O_constant.
 	Unused fields zeroed to help expr ().  */
 
 static void
@@ -1371,21 +1369,6 @@ clean_up_expression (expressionP)
     case O_bit_not:
       expressionP->X_op_symbol = NULL;
       break;
-    case O_subtract:
-      if (expressionP->X_op_symbol == expressionP->X_add_symbol
-	  || ((symbol_get_frag (expressionP->X_op_symbol)
-	       == symbol_get_frag (expressionP->X_add_symbol))
-	      && SEG_NORMAL (S_GET_SEGMENT (expressionP->X_add_symbol))))
-	{
-	  addressT diff = (S_GET_VALUE (expressionP->X_add_symbol)
-			   - S_GET_VALUE (expressionP->X_op_symbol));
-
-	  expressionP->X_op = O_constant;
-	  expressionP->X_add_symbol = NULL;
-	  expressionP->X_op_symbol = NULL;
-	  expressionP->X_add_number += diff;
-	}
-      break;
     default:
       break;
     }
@@ -1751,7 +1734,8 @@ expr (rankarg, resultP)
 	       && resultP->X_op == O_symbol
 	       && (symbol_get_frag (right.X_add_symbol)
 		   == symbol_get_frag (resultP->X_add_symbol))
-	       && SEG_NORMAL (rightseg))
+	       && (SEG_NORMAL (rightseg)
+		   || right.X_add_symbol == resultP->X_add_symbol))
 	{
 	  resultP->X_add_number -= right.X_add_number;
 	  resultP->X_add_number += (S_GET_VALUE (resultP->X_add_symbol)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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