With:

int
f1 (void)
{
  int x = 4, y;
  __asm__ volatile ("imull %3\n\tshrdl %%cl,%1,%0"
                    : "+a,a" (x), "=d,d" (y)
                    : "%0,0" (x), "m,r" (8), "c,c" (2));
  return x;
}

int
f2 (void)
{
  int x = 4, y;
  __asm__ volatile ("imull %3\n\tshrdl %%cl,%1,%0"
                    : "=a,a" (x), "=d,d" (y)
                    : "%0,0" (x), "m,r" (8), "c,c" (2));
  return x;
}

int
f3 (void)
{
  int x = 4, y;
  __asm__ volatile ("imull %2\n\tshrdl %%cl,%1,%0"
                    : "+a,a" (x), "=d,d" (y)
                    : "m,r" (8), "c,c" (2));
  return x;
}

int
f4 (void)
{
  int x = 4, y;
  __asm__ volatile ("imull %3\n\tshrdl %%cl,%1,%0"
                    : "+a" (x), "=d" (y)
                    : "%0" (x), "r" (8), "c" (2));
  return x;
}

int
f5 (void)
{
  int x = 4, y;
  __asm__ volatile ("imull %3\n\tshrdl %%cl,%1,%0"
                    : "=a" (x), "=d" (y)
                    : "%0" (x), "r" (8), "c" (2));
  return x;
}

int
f6 (void)
{
  int x = 4, y;
  __asm__ volatile ("imull %2\n\tshrdl %%cl,%1,%0"
                    : "+a" (x), "=d" (y)
                    : "r" (8), "c" (2));
  return x;
}

GCC 3.2.3 and 3.4.3 error on f4:
iasm.c:35: error: inconsistent operand constraints in an `asm'
while GCC 4 errors on f1 and f3:
iasm.c: In function `f1':
iasm.c:5: error: operand constraints for `asm' differ in number of alternatives
iasm.c: In function `f3':
iasm.c:25: error: operand constraints for `asm' differ in number of alternatives

This certainly seems to be inconsistent.  Either using %0 matching +a
is valid or not but I don't see anything wrong on f3.
If : "+a" (x) : "%0" (x) is invalid, then both f1 and f4 should fail and
all others pass, if it is valid, I think all functions ought to pass.

-- 
           Summary: Bogus differ in number of alternatives error
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i386-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20314

Reply via email to