gas:Reject ++ and --

Hans-Peter Nilsson hp@bitrange.com
Wed Mar 17 16:36:00 GMT 2004


On Wed, 17 Mar 2004, Nathan Sidwell wrote:
> Hi,
> 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
> I was having was a port which had an addressing mode syntax of the form
> 	reg++[reg]
> and desiring to process this as
> 	<expr> "++[" <expr> "]"
> but the expression evaluator ate the '++' as two '+' operators and
> then barfed.

I'd check for <reg> separately and before <expr> to avoid
problems like this.

> Regardless of those issues, the current '++' and '--' behaviour surprises
> at least some programmers (me and my users :)

Agree.

> built and tested on i686-pc-linux-gnu, ok?

A few test-cases to reflect the change?  There is framework for
tests for errors using the dg- stuff.  If nothing else see the
CRIS and MMIX gas testsuites, grep for dg-error.

brgds, H-P



More information about the Binutils mailing list