This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: gas:Reject ++ and --
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: binutils at sources dot redhat dot com,Michal Ostrowski <mostrows at watson dot ibm dot com>
- Date: Fri, 16 Apr 2004 11:24:27 +0930
- Subject: Re: gas:Reject ++ and --
- References: <40587B89.5050107@codesourcery.com>
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