Carlo Kok via llvm-dev
2021-Feb-25 21:06 UTC
[llvm-dev] llc/llvm crash compiling simple? code
Hi, I'm using llvm from february 17th, compiling code like this: ``` ; ModuleID = 'Console-16732e0113291fe028aebfc524751e88.o' source_filename = "Console-16732e0113291fe028aebfc524751e88" target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" target triple = "arm64-pc-windows-msvc" ; Function Attrs: uwtable define i8* @ms_ta__1sConsole8_ReadLine() { BasicBlock141: br label %BasicBlock143 BasicBlock143: ; preds = %BasicBlock162, %BasicBlock143.outer br label %BasicBlock146 BasicBlock146: ; preds = %BasicBlock144, %BasicBlock143 %0 = call i8 @ReadFile() #2 switch i8 %0, label %BasicBlock162 [ i8 0, label %BasicBlock158 i8 13, label %BasicBlock158 i8 10, label %BasicBlock158 ] BasicBlock158: ; preds = %BasicBlock146, %BasicBlock146, %BasicBlock146 ret i8* null BasicBlock162: ; preds = %BasicBlock146 br label %BasicBlock143 } declare dllimport i8 @ReadFile() ``` with llc on Windows gives me: C:\projects>\p\llvm-i386\Debug\bin\llc.exe c:\projects\Console-16732e0113291fe028aebfc524751e88.o.ll PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: \\p\\llvm-i386\\Debug\\bin\\llc.exe c:\\projects\\Console-16732e0113291fe028aebfc524751e88.o.ll 1. Running pass 'Function Pass Manager' on module 'c:\projects\Console-16732e0113291fe028aebfc524751e88.o.ll'. 2. Running pass 'AArch64 Instruction Selection' on function '@ms_ta__1sConsole8_ReadLine' #0 0x0124deef std::vector<class llvm::MachineBasicBlock *, class std::allocator<class llvm::MachineBasicBlock *>>::emplace_back<class llvm::MachineBasicBlock *const &>(class llvm::MachineBasicBlock *const &) C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vector:704:0 #1 0x0125162a std::vector<class llvm::MachineBasicBlock *, class std::allocator<class llvm::MachineBasicBlock *>>::push_back(class llvm::MachineBasicBlock *const &) C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vector:718:0 #2 0x023493ed llvm::MachineFunction::addToMBBNumbering(class llvm::MachineBasicBlock *) C:\p\llvm-project\llvm\include\llvm\CodeGen\MachineFunction.h:794:0 #3 0x02340720 llvm::ilist_callback_traits<class llvm::MachineBasicBlock>::addNodeToList(class llvm::MachineBasicBlock *) C:\p\llvm-project\llvm\lib\CodeGen\MachineBasicBlock.cpp:132:0 #4 0x00e6444d llvm::iplist_impl<class llvm::simple_ilist<class llvm::MachineBasicBlock>, struct llvm::ilist_traits<class llvm::MachineBasicBlock>>::insert(class llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class llvm::MachineBasicBlock, 0, 0, void>, 0, 0>, class llvm::MachineBasicBlock *) C:\p\llvm-project\llvm\include\llvm\ADT\ilist.h:230:0 #5 0x00e64521 llvm::MachineFunction::insert(class llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class llvm::MachineBasicBlock, 0, 0, void>, 0, 0>, class llvm::MachineBasicBlock *) C:\p\llvm-project\llvm\include\llvm\CodeGen\MachineFunction.h:758:0 #6 0x0343de58 llvm::SelectionDAGBuilder::lowerWorkItem(struct llvm::SwitchCG::SwitchWorkListItem, class llvm::Value *, class llvm::MachineBasicBlock *, class llvm::MachineBasicBlock *) C:\p\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGBuilder.cpp:10477:0 #7 0x034459ed llvm::SelectionDAGBuilder::visitSwitch(class llvm::SwitchInst const &) C:\p\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGBuilder.cpp:10841:0 #8 0x0343ee58 llvm::SelectionDAGBuilder::visit(unsigned int, class llvm::User const &) C:\p\llvm-project\llvm\include\llvm\IR\Instruction.def:129:0 #9 0x0343ed83 llvm::SelectionDAGBuilder::visit(class llvm::Instruction const &) C:\p\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGBuilder.cpp:1099:0 #10 0x032b333d llvm::SelectionDAGISel::SelectBasicBlock(class llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class llvm::Instruction, 0, 0, void>, 0, 1>, class llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class llvm::Instruction, 0, 0, void>, 0, 1>, bool &) C:\p\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:701:0 #11 0x032b2ec0 llvm::SelectionDAGISel::SelectAllBasicBlocks(class llvm::Function const &) C:\p\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:1610:0 #12 0x032ab312 llvm::SelectionDAGISel::runOnMachineFunction(class llvm::MachineFunction &) C:\p\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:506:0 #13 0x00e5b09b `anonymous namespace'::AArch64DAGToDAGISel::runOnMachineFunction C:\p\llvm-project\llvm\lib\Target\AArch64\AArch64ISelDAGToDAG.cpp:56:0 #14 0x0234b9d1 llvm::MachineFunctionPass::runOnFunction(class llvm::Function &) C:\p\llvm-project\llvm\lib\CodeGen\MachineFunctionPass.cpp:72:0 #15 0x02983212 llvm::FPPassManager::runOnFunction(class llvm::Function &) C:\p\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1434:0 #16 0x029834fa llvm::FPPassManager::runOnModule(class llvm::Module &) C:\p\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1480:0 #17 0x02983e32 `anonymous namespace'::MPPassManager::runOnModule C:\p\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1549:0 #18 0x029846c5 llvm::legacy::PassManagerImpl::run(class llvm::Module &) C:\p\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:540:0 #19 0x0297edcd llvm::legacy::PassManager::run(class llvm::Module &) C:\p\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1677:0 #20 0x00bd0020 compileModule C:\p\llvm-project\llvm\tools\llc\llc.cpp:687:0 #21 0x00bd1084 main C:\p\llvm-project\llvm\tools\llc\llc.cpp:386:0 #22 0x03fa7393 invoke_main d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0 #23 0x03fa7217 _scrt_common_main_seh d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0 #24 0x03fa70ad _scrt_common_main d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0 #25 0x03fa7418 mainCRTStartup d:\agent\_work\57\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0 #26 0x75bcfa29 (C:\WINDOWS\System32\KERNEL32.DLL+0x1fa29) #27 0x776776b4 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x676b4) #28 0x77677684 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x67684) Has anyone ever seen this and know what i'm doing wrong?