[llvm-bugs] [Bug 36570] New: Assertion failure in WebAssemblyCFGSort.cpp when compile c code to target wasm32/wasm64

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 2 06:41:37 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36570

            Bug ID: 36570
           Summary: Assertion failure in WebAssemblyCFGSort.cpp when
                    compile c code to target wasm32/wasm64
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: sighingnow at gmail.com
                CC: llvm-bugs at lists.llvm.org

An assertion failure cause the compiler crash when compile the following
trivial c code to wasm using clang with command `clang -c test.c --target
wasm32`. 

C code:

~~~c
int add(int a, int b) {
  return a + b;
}
~~~

I'm working on windows 10 64bit and build llvm trunk with gcc-7.3 64bit from
msys.

========================================

The complete crash backtrace:

>clang test.c -c --target=wasm64
Assertion failed!

Program: D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clang.exe
File: D:\Open\LLVM\llvm\llvm\lib\Target\WebAssembly\WebAssemblyCFGSort.cpp,
Line 251

Expression: OnStack.count(MLI.getLoopFor(&MBB)) && "Blocks must be nested in
their loops"

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Wrote crash dump file "D:\Local\Temp\clang.exe-ca6a10.dmp"
LLVMSymbolizer: error reading file: PDB Error: DIA is not installed on the
system

LLVMSymbolizer: error reading file: PDB Error: DIA is not installed on the
system

LLVMSymbolizer: error reading file: PDB Error: DIA is not installed on the
system

#0 0x000000000693faf6 HandleAbort
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMSupport.dll+0xafaf6)
#1 0x00007ffcc550a786 (C:\Windows\System32\msvcrt.dll+0x2a786)
#2 0x00007ffcc550ebae (C:\Windows\System32\msvcrt.dll+0x2ebae)
#3 0x000000006291d216 _wassert
C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/misc\wassert.c:54:0
#4 0x000000006291d2c6 _assert
C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/misc\wassert.c:31:0
#5 0x00000000628cc312 SortBlocks(llvm::MachineFunction&, llvm::MachineLoopInfo
const&, llvm::MachineDominatorTree const&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMWebAssemblyCodeGen.dll+0xc312)
#6 0x00000000628cd516 (anonymous
namespace)::WebAssemblyCFGSort::runOnMachineFunction(llvm::MachineFunction&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMWebAssemblyCodeGen.dll+0xd516)
#7 0x000000007057e90f llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMCodeGen.dll+0x13e90f)
#8 0x000000006f59e8a8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMCore.dll+0xde8a8)
#9 0x000000006f59e8fc llvm::FPPassManager::runOnModule(llvm::Module&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMCore.dll+0xde8fc)
#10 0x000000006f59def3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\LLVMCore.dll+0xddef3)
#11 0x00000000636c93b4 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangCodeGen.dll+0x93b4)
#12 0x0000000063a3ae4c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangCodeGen.dll+0x37ae4c)
#13 0x000000006e001abc clang::ParseAST(clang::Sema&, bool, bool)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangParse.dll+0x1abc)
#14 0x00000000639192b8 clang::CodeGenAction::ExecuteAction()
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangCodeGen.dll+0x2592b8)
#15 0x0000000064b71f39 clang::FrontendAction::Execute()
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangFrontend.dll+0x71f39)
#16 0x0000000064b391d8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangFrontend.dll+0x391d8)
#17 0x000000006d102b19
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clangFrontendTool.dll+0x2b19)
#18 0x00000000004027cd cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clang.exe+0x27cd)
#19 0x000000000040eee7 main
(D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin\clang.exe+0xeee7)
#20 0x00000000004013c7 __tmainCRTStartup
C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:339:0
#21 0x00000000004014fb mainCRTStartup
C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:217:0
#22 0x00007ffcc4801fe4 (C:\Windows\System32\KERNEL32.DLL+0x11fe4)
#23 0x00007ffcc59eefc1 (C:\Windows\SYSTEM32\ntdll.dll+0x6efc1)
clang.exe: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 326315) (llvm/trunk 326537)
Target: wasm64
Thread model: single
InstalledDir: D:\Open\LLVM\llvm\llvm\mingw-build-dev\bin
clang.exe: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang.exe: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang.exe: note: diagnostic msg: D:\Local\Temp\test-c38964.c
clang.exe: note: diagnostic msg: D:\Local\Temp\test-c38964.sh
clang.exe: note: diagnostic msg:

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

-- 
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/20180302/277ecd87/attachment.html>


More information about the llvm-bugs mailing list