Re: Bug#121269: gcc allows dollars in identifiers by default on i386 but fails
> > gcc by default allows dollars in identifiers on i386.
> > Unfortunately, the assembler does not like them.
>
> I'll spare the explanation of why the assembler barfs (since I'm assuming
> that it's as obvious to everyone else as it is to me)
Could you kindly elaborate a little? I assume one problem is that $
indicates literal values to the assembler, as in
movl $.LC1, (%esp)
That explains why dollars at the beginning of identifiers are not
acceptable. It doesn't explain why dollars *in* identifiers are
bad. In fact, the assembler doesn't have any problems if the dollar
sign is not the first character of the identifier.
I think this is the prime reason for allowing dollars, too: to put
them inside an identifier, to access assembler symbols that may be
otherwise inaccessible.
> I'll test as many platforms as are available to me to see what each is set
> for. Question to the rest of the gcc co-maintainers...should we go for
> consistency and set --no-dollars-in-identifiers by default on all targets
> or should we only set it on targets whose gcc outputs register names with
> dollar prefixes?
Interestingly enough, register names are not an issue on i386 - they
are prefixed with a percent sign.
So I don't think the default should be changed at all. If anything,
the dollar-starts-identifiers special case may require a warning.
Regards,
Martin
Reply to: