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

            Bug ID: 69716
           Summary: asm generates invalid register name
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugzilla at limegreensocks dot com
  Target Milestone: ---

While this is a problem with inline asm, it seems like it would be
target-specific which is why I set component: target.

I can produce the problem several ways.  This is probably the simplest:

    unsigned char a = 0;
    asm volatile("mov $0, %0" : "=r"(a) : : "ax", "bx", "cx", "dx");

Compile this with gcc -m32 -S, and you see:

    mov $0, %sil

However, sil is not a valid register name on x86 (although it is on x64).

You can get similar behavior with:

   unsigned char a, b, c, d, e;
   asm volatile("# %0 %1 %2 %3 %4" : "=r"(a),"=r"(b),"=r"(c),"=r"(d),"=r"(e));

This generates:

    # %dil %sil %bl %cl %dl

Neither dil nor sil are valid register names for 32bit.

Reply via email to