This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Very interesting IA64 gas bug
On Fri, Jun 06, 2003 at 05:47:04PM -0700, H. J. Lu wrote:
> On Fri, Jun 06, 2003 at 04:14:12PM -0700, Jim Wilson wrote:
> > I don't see any problem with the buffer itself. However, there is a
> > problem with the parsing algorithm in do_scrub_chars.
> >
> > do_scrub_chars tries to eliminate whitespace between arguments. It
> > assumes that it is starting at the beginning of a line, and that a line
> > looks like "label: opcode arguments" where label is optional. IA-64
> > instructions do not look like this, because we have qualifying
> > predicates before the opcode, e.g. (p7). This happens to work by
> > accident with the current parsing code because ( and ) are not symbol
> > characters, so do_scrub_chars assumes it is neither the label nor opcode
> > and passes it through unchanged without changing state.
> >
> > The problem occurs if a buffer ends in the middle of a qualifying
> > predicate (qp). The first buffer sees "(p" at the end, and because it
> > is at the end of the buffer, it stops in the middle of the qp and
> > switches to state 11 which means this may be a label. When we start the
> > next buffer, we switch to state 3 (after the opcode) because there was
> > no colon. The "hint" is then parsed as an argument, and we eliminate
> > the space after it, and now we have an unknown opcode hint@pause.
> >
> > This could be fixed by adding a new state for parsing IA-64 qps. If we
> > see an open paren before the opcode, then we switch to the new state,
> > and switch back to state 0 after seeing the ).
>
> I tried it. It still doesn't work in all cases. I am enclosing a patch
> and testsuite here.
>
Never mind. The patch seems to work fine.
H.J.