[LLVMbugs] [Bug 19117] New: MS Style inline ASM assertion failure and crash while parsing function argument name

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 12 13:56:43 PDT 2014


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

            Bug ID: 19117
           Summary: MS Style inline ASM assertion failure and crash while
                    parsing function argument name
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jb.feldman at kyrus-tech.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code is adapted from MS headers (ntddk.h) and causes a crash
(assertion failure) in clang-cl. This code compiles with cl.exe

typedef union _LARGE_INTEGER {
  struct {
    unsigned int LowPart;
    unsigned int  HighPart;
  };
  struct {
    unsigned int LowPart;
    unsigned int  HighPart;
  } u;
  unsigned long long QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;

int foo (LARGE_INTEGER LargeInteger)
{
    __asm    {
        mov     eax, LargeInteger.LowPart   ; ShiftCount >= 32
    }
}

This was compiled simply with clang-cl.exe -c sample.c 

This produces the following crash and stack trace:
Assertion failed: End.getPointer() <= EndPtr && "frontend claimed part of a
token?", file ..\..\..\..\..\lib\Target\X86\AsmParser\X86AsmParser.cpp, li
ne 1246
Stack dump:
0.      Program arguments: C:\WINDDK\3790~1.183\bin\clang-cl.exe -cc1 -triple
i686-pc-win32 -emit-obj -mrelax-all -disable-free -main-file-name sample
.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -target-cpu pentium4 -D_MT --dependent-lib=libcmt --de
pendent-lib=oldnames -fno-rtti -fdiagnostics-format msvc -coverage-file
C:\Users\jbf\Desktop\helloworld\sample.obj -resource-dir C:\WINDDK\3790~1.183\
bin\..\lib\clang\3.5.0 -internal-isystem
C:\WINDDK\3790~1.183\bin\..\lib\clang\3.5.0\include -internal-isystem
C:\WINDDK\3790~1.183\inc\w2K -fdebug-co
mpilation-dir C:\Users\jbf\Desktop\helloworld -ferror-limit 19 -fmessage-length
150 -mstackrealign -fms-extensions -fms-compatibility -fmsc-version=17
00 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-slp -o sample.obj -x c sample.c
1.      sample.c:21:1: current parser token '}'
2.      sample.c:17:1: parsing function body 'foo'
3.      sample.c:17:1: in compound statement ('{}')
0x5FA614FA (0x0000000A 0x00000000 0x059DB51C 0x5FB39AC4), memcmp() + 0xABA
bytes(s)
0x5FB4B26C (0x059DB568 0x059DB530 0x0000009E 0x0067DEA0), abort() + 0x1C
bytes(s)
0x5FB39AC4 (0x04491D08 0x04491C68 0x000004DE 0x059DB6F8), _wassert() + 0xD4
bytes(s)
0x012775A0 (0x059DB6D8 0x059DB6AC 0x059DB6BC 0x00000000), `anonymous
namespace'::X86AsmParser::ParseIntelIdentifier() + 0x120 bytes(s),
c:\llvm2\lib\t
arget\x86\asmparser\x86asmparser.cpp, line 1246 + 0x2D byte(s)
0x012763C3 (0x00000000 0x00000000 0x059DCB4D 0x00000000), `anonymous
namespace'::X86AsmParser::ParseIntelMemOperand() + 0x173 bytes(s),
c:\llvm2\lib\t
arget\x86\asmparser\x86asmparser.cpp, line 1331 + 0x1A byte(s)
0x01275671 (0x006BC300 0x059DBD48 0x0127CD79 0x059DC13C), `anonymous
namespace'::X86AsmParser::ParseIntelOperand() + 0x671 bytes(s),
c:\llvm2\lib\targ
et\x86\asmparser\x86asmparser.cpp, line 1564
0x01274D45 (0x059DC13C 0x059DBD64 0xCCCCCCCC 0xCCCCCCCC), `anonymous
namespace'::X86AsmParser::ParseOperand() + 0x25 bytes(s),
c:\llvm2\lib\target\x86
\asmparser\x86asmparser.cpp, line 913 + 0x8 byte(s)
0x0127CD79 (0x059DC090 0x059DC0A0 0x00000003 0x059DCB44), `anonymous
namespace'::X86AsmParser::ParseInstruction() + 0xAD9 bytes(s),
c:\llvm2\lib\targe
t\x86\asmparser\x86asmparser.cpp, line 1936 + 0x8 byte(s)
0x016E9E1B (0x059DC334 0x059DCEE4 0x059DC5B0 0xCCCCCCCC), `anonymous
namespace'::AsmParser::parseStatement() + 0x182B bytes(s),
c:\llvm2\lib\mc\mcpars
er\asmparser.cpp, line 1562 + 0x41 byte(s)
0x016E6150 (0x00000139 0x059DC824 0x059DC854 0x059DC848), `anonymous
namespace'::AsmParser::parseMSInlineAsm() + 0xF0 bytes(s),
c:\llvm2\lib\mc\mcpars
er\asmparser.cpp, line 4428 + 0xF byte(s)
0x028DD6A5 (0x059DD1C8 0x00000139 0x059DD298 0x059DE4D4),
clang::Parser::ParseMicrosoftAsmStatement() + 0xAC5 bytes(s),
c:\llvm2\tools\clang\lib\parse
\parsestmt.cpp, line 2211 + 0x6E byte(s)
0x028DC3C2 (0x059DD1C8 0x059DD20B 0x059DD2FC 0x00000076),
clang::Parser::ParseAsmStatement() + 0xC2 bytes(s),
c:\llvm2\tools\clang\lib\parse\parsestmt
.cpp, line 2270 + 0x10 byte(s)
0x028D7C05 (0x059DD2C0 0x059DD4FC 0x00000000 0x00000000),
clang::Parser::ParseStatementOrDeclarationAfterAttributes() + 0x4E5 bytes(s),
c:\llvm2\tools
\clang\lib\parse\parsestmt.cpp, line 280 + 0x16 byte(s)
0x028D75E7 (0x059DD334 0x059DD4FC 0x00000000 0x00000000),
clang::Parser::ParseStatementOrDeclaration() + 0x67 bytes(s),
c:\llvm2\tools\clang\lib\parse
\parsestmt.cpp, line 121
0x028D9739 (0x059DD638 0x00000000 0x059DD85C 0x059DE4D4),
clang::Parser::ParseCompoundStatementBody() + 0x399 bytes(s),
c:\llvm2\tools\clang\lib\parse
\parsestmt.cpp, line 908 + 0x1A byte(s)
0x028DF50F (0x0067E700 0x059DD748 0x059DDE60 0x059DE4D4),
clang::Parser::ParseFunctionStatementBody() + 0xDF bytes(s),
c:\llvm2\tools\clang\lib\parse\
parsestmt.cpp, line 2468
0x028843E1 (0x059DD9F0 0x059DD8FC 0x059DD9D0 0x059DDEF4),
clang::Parser::ParseFunctionDefinition() + 0x971 bytes(s),
c:\llvm2\tools\clang\lib\parse\pa
rser.cpp, line 1114 + 0x16 byte(s)
0x0289F1F9 (0x059DE478 0x059DDF2C 0x00000000 0x00000001),
clang::Parser::ParseDeclGroup() + 0x179 bytes(s),
c:\llvm2\tools\clang\lib\parse\parsedecl.c
pp, line 1607 + 0x22 byte(s)
0x028839FC (0x059DE478 0x059DE4A0 0x059DDF2C 0x00000003),
clang::Parser::ParseDeclOrFunctionDefInternal() + 0x2DC bytes(s),
c:\llvm2\tools\clang\lib\p
arse\parser.cpp, line 884 + 0x18 byte(s)
0x028836A9 (0x059DE478 0x059DE4A0 0x00000000 0x00000003),
clang::Parser::ParseDeclarationOrFunctionDefinition() + 0x89 bytes(s),
c:\llvm2\tools\clang\
lib\parse\parser.cpp, line 900 + 0x1B byte(s)
0x028830A4 (0x059DE478 0x059DE4A0 0x00000000 0x059DE558),
clang::Parser::ParseExternalDeclaration() + 0x984 bytes(s),
c:\llvm2\tools\clang\lib\parse\p
arser.cpp, line 758 + 0x16 byte(s)
0x0287FB4F (0x059DE510 0x059DE75C 0x059DE568 0x006BAE50),
clang::Parser::ParseTopLevelDecl() + 0x1DF bytes(s),
c:\llvm2\tools\clang\lib\parse\parser.c
pp, line 558 + 0x12 byte(s)
0x0287E019 (0x006AD2A8 0x00000000 0x00000000 0x059DE764), clang::ParseAST() +
0x1B9 bytes(s), c:\llvm2\tools\clang\lib\parse\parseast.cpp, line 144 +
0xC byte(s)
0x01ABCED1 (0x059DE7E0 0xCCCCCCCC 0xCCCCCCCC 0xCCCCCCCC),
clang::ASTFrontendAction::ExecuteAction() + 0x101 bytes(s),
c:\llvm2\tools\clang\lib\fronten
d\frontendaction.cpp, line 501 + 0x30 byte(s)
0x0207D902 (0x059DE78C 0xCCCCCCCC 0xCCCCCCCC 0xCCCCCCCC),
clang::CodeGenAction::ExecuteAction() + 0x392 bytes(s),
c:\llvm2\tools\clang\lib\codegen\cod
egenaction.cpp, line 567
0x01ABCAEC (0x059DE87C 0x059DF8E4 0xCCCCCCCC 0xCCCCCCCC),
clang::FrontendAction::Execute() + 0xAC bytes(s),
c:\llvm2\tools\clang\lib\frontend\frontend
action.cpp, line 403 + 0xF byte(s)
0x01A8CA11 (0x00653478 0x059DEDDC 0xCCCCCCCC 0xCCCCCCCC),
clang::CompilerInstance::ExecuteAction() + 0x281 bytes(s),
c:\llvm2\tools\clang\lib\frontend
\compilerinstance.cpp, line 727
0x01BC4E5B (0x00651B70 0x059DFD04 0xCCCCCCCC 0xCCCCCCCC),
clang::ExecuteCompilerInvocation() + 0x30B bytes(s),
c:\llvm2\tools\clang\lib\frontendtool\e
xecutecompilerinvocation.cpp, line 239 + 0x11 byte(s)
0x00C0F560 (0x059DF8EC 0x059DF9B0 0x00654DA8 0x00B512FD), cc1_main() + 0x2F0
bytes(s), c:\llvm2\tools\clang\tools\driver\cc1_main.cpp, line 101 + 0xE
byte(s)
0x00BFFC8F (0x00000033 0x006516A0 0x00646B20 0x94A3B1EE), main() + 0x22F
bytes(s), c:\llvm2\tools\clang\tools\driver\driver.cpp, line 315 + 0x45 byte(
s)
0x035D1219 (0x059DFD68 0x750333AA 0x7EFDE000 0x059DFDA8), __tmainCRTStartup() +
0x199 bytes(s), f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c, line 626 +
 0x19 byte(s)
0x035D135D (0x7EFDE000 0x059DFDA8 0x76F19F72 0x7EFDE000), mainCRTStartup() +
0xD bytes(s), f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c, line 466
0x750333AA (0x7EFDE000 0x5A49BBF5 0x00000000 0x00000000), BaseThreadInitThunk()
+ 0x12 bytes(s)
0x76F19F72 (0x035D1350 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeExceptionChain() + 0x63 bytes(s)
0x76F19F45 (0x035D1350 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeExceptionChain() + 0x36 bytes(s)

-- 
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/20140312/23b7f2f2/attachment.html>


More information about the llvm-bugs mailing list