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]

Re: gas:Reject ++ and --


On Wed, Mar 17, 2004 at 04:23:37PM +0000, Nathan Sidwell wrote:
> the attached patch causes gas to not interpret ++ and -- as two
> + or - operators in a row.  The current behaviour is to allow
> 'a ++ b' as if it was 'a + (+b)' and '++ a' as if '+(+a)'.  The problem

This patch had an off-by-one error, breaking code like the following:

	.text
        stdu 1,-(-(-0x128)+0x70 +(2*8))(1)

gas/ChangeLog
	* expr.c (operand): Correct checks for ++ and --.

Applying both mainline and branch.

Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.49
diff -u -p -r1.49 expr.c
--- gas/expr.c	18 Mar 2004 09:19:20 -0000	1.49
+++ gas/expr.c	16 Apr 2004 01:48:14 -0000
@@ -1022,7 +1022,7 @@ operand (expressionS *expressionP)
 
     case '+':
       /* Do not accept ++e as +(+e) */
-      if (input_line_pointer[1] == '+')
+      if (*input_line_pointer == '+')
 	goto target_op;
       (void) operand (expressionP);
       break;
@@ -1042,7 +1042,7 @@ operand (expressionS *expressionP)
     case '-':
       {
         /* Do not accept --e as -(-e) */
-	if (c == '-' && input_line_pointer[1] == '-')
+	if (c == '-' && *input_line_pointer == '-')
 	  goto target_op;
 	
 	operand (expressionP);

-- 
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]