[PATCH] D37461: [X86][AsmParser] re-introduce 'offset' operator

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 08:05:25 PDT 2018


thakis added a comment.

Thanks for working on this! I'd be happy to see this fixed. It also likely helps with PR36676.

I patched it in to play with it (it still applies with just two hunks not applying via `patch`, but manually applying them seems easy.) I got an assert on this code (which is from Windows.h):

  $ cat repro.ii
  void Int64ShrlMod32(unsigned __int64 Value) {
    __asm {
      mov edx, dword ptr [Value+4]
    }
  }
  $ bin/clang-7.0 -cc1 -triple i386-pc-windows-msvc19.11.0 -S -disable-free -main-file-name moved.i -mrelocation-model static -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -mllvm -x86-asm-syntax=intel -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -fms-volatile -fdiagnostics-format msvc -dwarf-column-info -debugger-tuning=gdb -target-linker-version 305 -momit-leaf-frame-pointer -ffunction-sections -coverage-notes-file /Users/thakis/src/llvm-build-goma/moved.gcno -resource-dir /Users/thakis/src/llvm-build-goma/lib/clang/7.0.0 -Os -Wno-msvc-not-found -WCL4 -fdebug-compilation-dir /Users/thakis/src/llvm-build-goma -ferror-limit 19 -fmessage-length 254 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o moved.asm -x cpp-output repro.ii
  Assertion failed: (AR.IntelExp.isValid() && "cannot write invalid intel expression"), function parseMSInlineAsm, file /Users/thakis/src/llvm-rw/lib/MC/MCParser/AsmParser.cpp, line 5709.
  Stack dump:
  0.	Program arguments: /Users/thakis/src/llvm-build-goma/bin/clang-7.0 -cc1 -triple i386-pc-windows-msvc19.11.0 -S -disable-free -main-file-name moved.i -mrelocation-model static -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -mllvm -x86-asm-syntax=intel -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -fms-volatile -fdiagnostics-format msvc -dwarf-column-info -debugger-tuning=gdb -target-linker-version 305 -momit-leaf-frame-pointer -ffunction-sections -coverage-notes-file /Users/thakis/src/llvm-build-goma/moved.gcno -resource-dir /Users/thakis/src/llvm-build-goma/lib/clang/7.0.0 -Os -Wno-msvc-not-found -WCL4 -fdebug-compilation-dir /Users/thakis/src/llvm-build-goma -ferror-limit 19 -fmessage-length 254 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o moved.asm -x cpp-output repro.ii 
  1.	repro.ii:5:1: current parser token '}'
  2.	repro.ii:1:45: parsing function body 'Int64ShrlMod32'
  3.	repro.ii:1:45: in compound statement ('{}')
  0  clang-7.0                0x000000010d82ebc8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
  1  clang-7.0                0x000000010d82ddc5 llvm::sys::RunSignalHandlers() + 85
  2  clang-7.0                0x000000010d82f1d2 SignalHandler(int) + 258
  3  libsystem_platform.dylib 0x00007fffc1fd2b3a _sigtramp + 26
  4  libsystem_platform.dylib 0x00007fff532a277c _sigtramp + 2435644508
  5  libsystem_c.dylib        0x00007fffc1e57420 abort + 129
  6  libsystem_c.dylib        0x00007fffc1e1e893 basename_r + 0
  7  clang-7.0                0x000000010d5320cd (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&) + 7981
  8  clang-7.0                0x000000010e936e52 clang::Parser::ParseMicrosoftAsmStatement(clang::SourceLocation) + 5746
  9  clang-7.0                0x000000010e92bf66 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) + 1238
  10 clang-7.0                0x000000010e92b938 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) + 264
  11 clang-7.0                0x000000010e933739 clang::Parser::ParseCompoundStatementBody(bool) + 1497


Repository:
  rL LLVM

https://reviews.llvm.org/D37461





More information about the llvm-commits mailing list