[LLVMbugs] [Bug 13795] New: MIPS inline asm() fails on register constraints with "couldn't allocate output register for constraint '{$2}'"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 7 14:18:07 PDT 2012


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

             Bug #: 13795
           Summary: MIPS inline asm() fails on register constraints with
                    "couldn't allocate output register for constraint
                    '{$2}'"
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ezdiy at outlook.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Linux MIPS32/O32 syscall implementation:

$ cat ss.c
long __syscall0(long nr)
{
    register long __a3 __asm__("$7");
    register long __v0 __asm__("$2");
    __asm__ __volatile__ (
            ".set noreorder\n"
            "syscall\n"
            ".set reorder\n"
            : "=r" (__v0), "=r" (__a3)
            : "l" (nr)
            : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
              "$14", "$15", "$24", "$25", "hi", "lo", "memory");
    return __a3?-__v0:__v0;
}


$ clang -target mipsel-elf-linux -O3 -S ss.c 
ss.c:6:13: error: couldn't allocate output register for constraint '{$2}'
            ".set noreorder\n"
            ^
ss.c:6:13: error: couldn't allocate output register for constraint '{$7}'
0  clang           0x0000000001e9b66f
1  clang           0x0000000001e9bb29
2  libpthread.so.0 0x00007fe847f28140
3  clang           0x0000000001a29da4
4  clang           0x0000000001a2c060
5  clang           0x0000000001a2de8b
6  clang           0x0000000001e3251f
llvm::FPPassManager::runOnFunction(llvm::Function&) + 607
7  clang           0x0000000001e32573
llvm::FPPassManager::runOnModule(llvm::Module&) + 51
8  clang           0x0000000001e3224c
llvm::MPPassManager::runOnModule(llvm::Module&) + 524
9  clang           0x0000000001e358bf llvm::PassManagerImpl::run(llvm::Module&)
+ 143
10 clang           0x00000000007c91d8
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 2136
11 clang           0x00000000007c71ff
12 clang           0x0000000000906efa clang::ParseAST(clang::Sema&, bool, bool)
+ 554
13 clang           0x00000000007c5e14 clang::CodeGenAction::ExecuteAction() +
68
14 clang           0x000000000066e1b3 clang::FrontendAction::Execute() + 131
15 clang           0x000000000064dfe9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 329
16 clang           0x0000000000634835
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1429
17 clang           0x000000000062b3ba cc1_main(char const**, char const**, char
const*, void*) + 7018
18 clang           0x00000000006333c0 main + 8000
19 libc.so.6       0x00007fe847187455 __libc_start_main + 245
20 clang           0x0000000000628c09
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple mipsel-elf-linux -S
-disable-free -main-file-name ss.c -mrelocation-model static -mdisable-fp-elim
-fmath-errno -mconstructor-aliases -target-cpu mips32 -target-abi o32
-mfloat-abi hard -target-linker-version 2.22.0.20120323
-momit-leaf-frame-pointer -coverage-file /home/sd/ss.s -resource-dir
/usr/local/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.2/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fno-dwarf-directory-asm
-fdebug-compilation-dir /home/sd -ferror-limit 19 -fmessage-length 190
-mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-o ss.s -x c ss.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'ss.c'.
4.    Running pass 'Machine Common Subexpression Elimination' on function
'@__syscall0'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 163311)
Target: mipsel-elf-linux
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/ss-OzLVQf.c
clang: note: diagnostic msg: /tmp/ss-OzLVQf.sh
clang: note: diagnostic msg: 

********************

-- 
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