[Bug target/53929] Bug in the use of Intel asm syntax when a global is named "and"

u1049321969 at caramail dot com gcc-bugzilla@gcc.gnu.org
Sat Sep 5 07:49:26 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53929

tk <u1049321969 at caramail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |u1049321969 at caramail dot com

--- Comment #1 from tk <u1049321969 at caramail dot com> ---
Hello all,

I would like to report that I hit upon a related issue in GCC 10.0.1.  Besides
complaining on "and", the assembly pass also complains if I use a symbol which
happens to be the same as register name, e.g. "bx".

$ gcc-10 --version
gcc-10 (Ubuntu 10-20200411-0ubuntu1) 10.0.1 20200411 (experimental) [master
revision bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566]
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat test.c
int bx[16];

int f(unsigned x)
{
        return bx[x];
}
$ gcc-10 -c test.c -O3 -masm=intel
/tmp/ccGtGi2X.s: Assembler messages:
/tmp/ccGtGi2X.s:12: Error: invalid use of register

The offending line in the assembly code says
        lea     rax, bx[rip]

The problem does _not_ go away even if I quote the symbol name by hand in the
assembly output, e.g.
        lea     rax, "bx"[rip]

Thank you!


More information about the Gcc-bugs mailing list