[LLVMbugs] [Bug 20368] New: clang-cl: Assertion failure: "Expected Loc to be at or after Start"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 19 16:48:17 PDT 2014


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

            Bug ID: 20368
           Summary: clang-cl: Assertion failure: "Expected Loc to be at or
                    after Start"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ehsan at mozilla.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat test3.c
void t36() {
  int arr[4];
  __asm {
  mov eax, 12[4 + arr]
  mov eax, 4[64 + arr + (2*32)]
  mov eax, 4[64 + arr - 2*32]
  mov eax, [arr + 4]
  mov eax, [arr + 4 + 32*2 - 4]
  mov eax, [4 + arr]
  mov eax, [4 + arr + 4]
  mov eax, [64 + arr + (2*32)]
  mov eax, [64 + arr - 2*32]
  }
}

$ clang-cl -c test3.c
Assertion failed: (Loc >= AsmStart && "Expected Loc to be at or after Start!"),
function parseMSInlineAsm, file
/Users/ehsan/src/llvm-svn/lib/MC/MCParser/AsmParser.cpp, line 4596.
0  clang-3.5                0x0000000104928b6e
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang-3.5                0x0000000104928e7b
PrintStackTraceSignalHandler(void*) + 27
2  clang-3.5                0x000000010492920c SignalHandler(int) + 412
3  libsystem_platform.dylib 0x00007fff94cb35aa _sigtramp + 26
4  libsystem_c.dylib        0x00007fff8e182117 _qsort + 2011
5  clang-3.5                0x0000000104928eab raise + 27
6  clang-3.5                0x0000000104928f62 abort + 18
7  clang-3.5                0x0000000104928f41 __assert_rtn + 129
8  clang-3.5                0x000000010462c20f (anonymous
namespace)::AsmParser::parseMSInlineAsm(void*, std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >&, unsigned int&,
unsigned int&, llvm::SmallVectorImpl<std::__1::pair<void*, bool> >&,
llvm::SmallVectorImpl<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > >&,
llvm::SmallVectorImpl<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > >&, llvm::MCInstrInfo const*, llvm::MCInstPrinter
const*, llvm::MCAsmParserSemaCallback&) + 5295
9  clang-3.5                0x0000000105d361e6
clang::Parser::ParseMicrosoftAsmStatement(clang::SourceLocation) + 7782
10 clang-3.5                0x0000000105d376ad
clang::Parser::ParseAsmStatement(bool&) + 317
11 clang-3.5                0x0000000105d2b5b0
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2256
12 clang-3.5                0x0000000105d2ab95
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 133
13 clang-3.5                0x0000000105d3172e
clang::Parser::ParseCompoundStatementBody(bool) + 1262
14 clang-3.5                0x0000000105d32748
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 328
15 clang-3.5                0x0000000105d4dcdc
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
3580
16 clang-3.5                0x0000000105cc1081
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 481
17 clang-3.5                0x0000000105d4cecc
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 1228
18 clang-3.5                0x0000000105d4c5f1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 161
19 clang-3.5                0x0000000105d4bd49
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 3577
20 clang-3.5                0x0000000105d4aedf
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 703
21 clang-3.5                0x0000000105caf6bb clang::ParseAST(clang::Sema&,
bool, bool) + 731
22 clang-3.5                0x0000000104d29efa
clang::ASTFrontendAction::ExecuteAction() + 522
23 clang-3.5                0x00000001052e26eb
clang::CodeGenAction::ExecuteAction() + 3307
24 clang-3.5                0x0000000104d29968 clang::FrontendAction::Execute()
+ 120
25 clang-3.5                0x0000000104cc3b04
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 996
26 clang-3.5                0x0000000104d86a60
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3200
27 clang-3.5                0x00000001030f14a0 cc1_main(char const**, char
const**, char const*, void*) + 2368
28 clang-3.5                0x00000001030e552a main + 858
29 libdyld.dylib            0x00007fff9251b5fd start + 1
Stack dump:
0.    Program arguments: /Users/ehsan/src/tmp/bin/clang-3.5 -cc1 -triple
x86_64-apple-windows-msvc -emit-obj -mrelax-all -disable-free -main-file-name
test3.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -relaxed-aliasing
-fmath-errno -masm-verbose -mconstructor-aliases -target-cpu x86-64 -D_MT
--dependent-lib=libcmt --dependent-lib=oldnames -fdiagnostics-format msvc
-dwarf-column-info -coverage-file /Users/ehsan/src/tmp/test3.obj -resource-dir
/Users/ehsan/src/tmp/bin/../lib/clang/3.5.0 -internal-isystem
/Users/ehsan/src/tmp/bin/../lib/clang/3.5.0/include -internal-isystem
C:/Program Files/Microsoft Visual Studio 10.0/VC/include -internal-isystem
C:/Program Files/Microsoft Visual Studio 9.0/VC/include -internal-isystem
C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include
-internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/include
-internal-isystem C:/Program Files/Microsoft Visual Studio
8/VC/PlatformSDK/Include -fdebug-compilation-dir /Users/ehsan/src/tmp
-ferror-limit 19 -fmessage-length 180 -mstackrealign -fms-extensions
-fms-compatibility -fms-compatibility-version=17.00 -fdelayed-template-parsing
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o test3.obj
-x c test3.c
1.    test3.c:14:1: current parser token '}'
2.    test3.c:1:12: parsing function body 't36'
3.    test3.c:1:12: in compound statement ('{}')
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 (213464)
Target: x86_64-apple-windows-msvc
Thread model: posix
clang-3.5: 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-3.5: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.5: note: diagnostic msg:
/var/folders/ry/m4kkhrl17c76cqyfd5qv5sph0000gn/T/test3-f0457e.c
clang-3.5: note: diagnostic msg:
/var/folders/ry/m4kkhrl17c76cqyfd5qv5sph0000gn/T/test3-f0457e.sh
clang-3.5: note: diagnostic msg:

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


Note that this code is taken from test/CodeGen/ms-inline-asm.c, t36, the only
change that I have made is put all of these asm statements in the same __asm
block.  Removing any of the statements makes the assertion go away.

I found this when I was working on merging single-line __asm statements.

-- 
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/20140719/9ae9c6a9/attachment.html>


More information about the llvm-bugs mailing list