Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionStanislav Kozina
2011-12-21 10:01:05 UTC
Description of problem:
Compilation of attached source code leads to operation on non-existing register.
Therefore the assembler cannot produce the binary.
Version-Release number of selected component (if applicable):
$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
How reproducible:
Always
Steps to Reproduce:
1. Compile the attached source code using $ gcc -S -m32 -O test.c
2. Assemble the assembled code using $ gcc -c -m32 test.s
3.
Actual results:
$ gcc -c -m32 test.s
test.c: Assembler messages:
test.c:3: Error: bad register name `%sil'
Expected results:
Assembler succeeds, the assembler code should not contain register '%sil'.
Additional info:
The source code contains inline assembler:
__asm__ ("movb %0,%%fs:%1"::"r" (val),"m" (*addr));
which is compiled into
movb %sil,%fs:(%ecx,%edx)
(note the %sil register, which does not exist on i386).
It's the compiler which fills the actual registers into this instruction.
In short, we set 32-bit register, and then we need to read lowest 8 bits of it.
If the compiler would use one of %eax, %ebx, %ecx or %edx registers, everything would be fine.
But it uses %esi, which does not have its 8-bit variant.
The source code first does few loops and function calls - these are compiled into usage of all %ec* registers, so the compiler use %esi for inline assembler. Without these function calls it would use %eax.
Note that the %sil register actually exist on x86_64, because all legacy registers very extended to cover also 8-bit variants.
The inline asm is just invalid. If you have on i?86 an 8 bit value you want to put into a register, you must use "q" constraint for it instead of "r", only that ensures it will be allocated in %al/%bl/%cl/%dl and no other registers.