[LLVMbugs] [Bug 7393] New: Bad codegen with inline assembly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 16 17:59:29 PDT 2010


           Summary: Bad codegen with inline assembly
           Product: libraries
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alex.gaynor at gmail.com
                CC: llvmbugs at cs.uiuc.edu

The following bad codegen shows up when compiling PyPy:

alex at alex-laptop:/tmp$ cat test.c 
#include <stdio.h>

#define pypy_asm_gcroot(p) ({int _r; \
               asm ("/* GCROOT %0 */" : "=g" (_r) : \
                    "0" (p)); \
               _r; })

int main() {
    int i, j;
    j = 4;
    i = pypy_asm_gcroot(j);
    printf("%d\n", i);
    return 0;
alex at alex-laptop:/tmp$ clang test.c 
alex at alex-laptop:/tmp$ ./a.out 
alex at alex-laptop:/tmp$ gcc test.c 
alex at alex-laptop:/tmp$ ./a.out 
alex at alex-laptop:/tmp$ llvm-gcc test.c 
alex at alex-laptop:/tmp$ ./a.out 

This reproduces with llvm-gcc, GCC prints out the expected answer.

has comments which explain the strange macro/ASM.

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