[LLVMbugs] [Bug 3345] New: clang rejects asm code accepted by gcc and icc

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jan 17 08:42:35 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=3345

           Summary: clang rejects asm code accepted by gcc and icc
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bagnara at cs.unipr.it
                CC: llvmbugs at cs.uiuc.edu, bolzoni at cs.unipr.it


This code comes straight from the Linux kernel.

$ cat /tmp/bug2.c 
unsigned long __clear_user(void *addr, unsigned long size)
{
 long __d0;


 asm volatile(
  "     testq  %[size8],%[size8]\n"
  "     jz     4f\n"
  "0:   movq %[zero],(%[dst])\n"
  "     addq   %[eight],%[dst]\n"
  "     decl %%ecx ; jnz   0b\n"
  "4:   movq  %[size1],%%rcx\n"
  "     testl %%ecx,%%ecx\n"
  "     jz     2f\n"
  "1:   movb   %b[zero],(%[dst])\n"
  "     incq   %[dst]\n"
  "     decl %%ecx ; jnz  1b\n"
  "2:\n"
  ".section .fixup,\"ax\"\n"
  "3:   lea 0(%[size1],%[size8],8),%[size8]\n"
  "     jmp 2b\n"
  ".previous\n"
  ".section __ex_table,\"a\"\n"
  "       .align 8\n"
  "     .quad 0b,3b\n"
  "     .quad 1b,2b\n"
  ".previous"
  : [size8] "=c"(size), [dst] "=&D" (__d0)
  : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr),
    [zero] "r" (0UL), [eight] "r" (8UL));
 return size;
}
$ gcc -w -c /tmp/bug2.c
$ icc -w -c /tmp/bug2.c
$ clang /tmp/bug2.c
/tmp/bug2.c:29:28: error: invalid input constraint '[size8]' in asm
  : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr),
                           ^
1 diagnostic generated.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list