[LLVMbugs] [Bug 6520] New: [inline asm] early clobber + forced register + -O0 == wrong register allocation
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Mar 5 19:34:23 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=6520
Summary: [inline asm] early clobber + forced register + -O0 ==
wrong register allocation
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: kaffeemonster at googlemail.com
CC: llvmbugs at cs.uiuc.edu
I build myself a fresh clang today at trunk r97864.
I was trying to hunt down another bug, but was first stopped by this one:
char *func(void)
{
char *ret, *p;
unsigned long t;
asm (
"mov $0xdeafbeef, %1\n\t"
"mov $0xcafebabe, %0\n\t"
"mov %0, %2\n\t"
: /* %0 */ "=&r" (ret),
/* %1 */ "=&r" (p),
/* %2 */ "=&c" (t)
);
return ret;
}
compiled with:
clang -c test.c
results in, stripping the prologue/epilogue:
9: b9 ef be af de mov $0xdeafbeef,%ecx
e: b8 be ba fe ca mov $0xcafebabe,%eax
13: 89 c1 mov %eax,%ecx
as you can see, %2 and %1 get the same register. This only happens when:
- there are early clobbers
- one variable is forced into a specific register with a constrain
- no optimization is used
The problem is mainly i need -O0 ATM, because i need working debug info (which
is also broken ATM), so i can hunt down another bug (compiled by clang my
programm crashes).
Greetings
Jan
--
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