[LLVMbugs] [Bug 20343] New: Using segment registers in inline asm cause "Invalid register passed in" assert

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 17 10:23:09 PDT 2014


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

            Bug ID: 20343
           Summary: Using segment registers in inline asm cause "Invalid
                    register passed in" assert
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

void NaClSetSs(unsigned short seg1) {
  __asm mov cs, seg1;
  __asm mov ds, seg1;
  __asm mov es, seg1;
  __asm mov fs, seg1;
  __asm mov gs, seg1;
  __asm mov ss, seg1;
}


$ ~/src/llvm-build/bin/clang -c test.c -fasm-blocks
Assertion failed: (isValidGCCRegisterName(Name) && "Invalid register passed
in"), function getNormalizedGCCRegisterName, file
/Users/thakis/src/llvm-svn/tools/clang/lib/Basic/TargetInfo.cpp, line 386.
0  clang-3.5                0x00000001077020e8
llvm::sys::PrintStackTrace(__sFILE*) + 40
1  clang-3.5                0x00000001077025d4 SignalHandler(int) + 564
2  libsystem_platform.dylib 0x00007fff8e6bf5aa _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1905527408
4  clang-3.5                0x0000000107702386 abort + 22
5  clang-3.5                0x0000000107702361 __assert_rtn + 81
6  clang-3.5                0x00000001077e4b2d
clang::TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef) const + 781
7  clang-3.5                0x0000000107c5dfa6
clang::CodeGen::CodeGenFunction::EmitAsmStmt(clang::AsmStmt const&) + 7638
8  clang-3.5                0x0000000107c5950d
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 621
9  clang-3.5                0x0000000107c6044b
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 91
10 clang-3.5                0x0000000107c7080d
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 93
11 clang-3.5                0x0000000107c70d64
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1076
12 clang-3.5                0x0000000107c7db0d
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 669
13 clang-3.5                0x0000000107c7b39d
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 253
14 clang-3.5                0x0000000107c7cd66
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 790
15 clang-3.5                0x0000000107c7f8d4
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 1188
16 clang-3.5                0x0000000107ccda2f (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 127
17 clang-3.5                0x0000000107c6c605
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 165
18 clang-3.5                0x0000000107f6b393 clang::ParseAST(clang::Sema&,
bool, bool) + 371
19 clang-3.5                0x0000000107c6b33b
clang::CodeGenAction::ExecuteAction() + 123
20 clang-3.5                0x00000001078efff3 clang::FrontendAction::Execute()
+ 67
21 clang-3.5                0x00000001078c4a73
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 931
22 clang-3.5                0x0000000107929e90
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4256
23 clang-3.5                0x0000000106a12977 cc1_main(char const**, char
const**, char const*, void*) + 903
24 clang-3.5                0x0000000106a1101d main + 8653
25 libdyld.dylib            0x00007fff93a8f5fd start + 1
Stack dump:
0.    Program arguments: /Volumes/MacintoshHD2/src/llvm-build/bin/clang-3.5
-cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-main-file-name test.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -dwarf-column-info
-coverage-file /Users/thakis/src/chrome-git/src/test.o -resource-dir
/Volumes/MacintoshHD2/src/llvm-build/bin/../lib/clang/3.5.0
-fdebug-compilation-dir /Users/thakis/src/chrome-git/src -ferror-limit 19
-fmessage-length 358 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature
-fdiagnostics-show-option -fcolor-diagnostics -fasm-blocks -o test.o -x c
test.c 
1.    <eof> parser at end of file
2.    test.c:1:6: LLVM IR generation of declaration 'NaClSetSs'
3.    test.c:1:6: Generating code for declaration 'NaClSetSs'
clang-3.5: error: unable to execute command: Illegal instruction: 4
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (213197)
Target: x86_64-apple-darwin13.2.0
Thread model: posix


lib/Basic/Targets.cpp : GCCRegNames doesn't list the segment registers, but MC
seems to understand them well enough to not reject them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140717/4dde2b69/attachment.html>


More information about the llvm-bugs mailing list