[PATCH] S12Z: gas: Fix bug when a symbol name was the single letter 'c'.
John Darrington
john@darrington.wattle.id.au
Wed Jan 16 13:15:00 GMT 2019
On Wed, Jan 16, 2019 at 11:52:30AM +0000, Nick Clifton wrote:
Hi John,
> The assembler incorrectly recognised "c" as a register name, and
> refused to allow it where it expected a symbol/label.
This sounds like it might be a more serious problem...
> + st d0, c ; c is a valid label
How does the assembler know that "c" here is meant to be label c
and not the register c ?
Because there is no register called "c". Also a register would be
semantically incorrect here.
(In other architectures it is often common practice for the compiler
to prefix all user generated symbols with a character, usually an
underscore, so that it is possible to distinguish between register
names and user symbols).
The compiler is free to do that.
It is unfortunate that in this arch the conventional assembler format
has no syntactical distinction between a register name and a
symbol name. Hence, all symbol names are compared against the list of
register names before use. Sadly this means the grammar is not context
free.
J'
More information about the Binutils
mailing list