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 Fri, Apr 16, 2004 at 04:28:49PM +0100, Nathan Sidwell wrote:
> Alan Modra wrote:
> >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:
> Gah!, sorry

Even with this fix the ++/-- patch breaks previously working code.
E.g. Linux kernel contains:
#define MOVE_SHORTCHUNK(src, dst, offset, t0, t1) \
        ldub    [%src - offset - 0x02], %t0; \
        ldub    [%src - offset - 0x01], %t1; \
        stb     %t0, [%dst - offset - 0x02]; \
        stb     %t1, [%dst - offset - 0x01];
...
        MOVE_SHORTCHUNK(o1, o0, -0x02, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x04, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x06, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x08, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x0a, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x0c, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x0e, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, -0x10, g2, g3)
...
        MOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
        MOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
...
Note there wasn't ++ nor -- present in the assembly, but
ldub [%o1 - -0x02 - 0x02], %g2
Yet current CVS gas still refuses it.

	Jakub


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