[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
http://llvm.org/bugs/show_bug.cgi?id=7393
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
134513739
alex at alex-laptop:/tmp$ gcc test.c
alex at alex-laptop:/tmp$ ./a.out
4
alex at alex-laptop:/tmp$ llvm-gcc test.c
alex at alex-laptop:/tmp$ ./a.out
13296805
This reproduces with llvm-gcc, GCC prints out the expected answer.
https://codespeak.net/viewvc/pypy/trunk/pypy/translator/c/src/mem.h?&view=markup
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