[llvm-bugs] [Bug 43566] New: Assertion failed: getNumber() >= 0 && "cannot get label for unreachable MBB" when targeting x86_x64 windows

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 4 11:17:25 PDT 2019


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

            Bug ID: 43566
           Summary: Assertion failed: getNumber() >= 0 && "cannot get
                    label for unreachable MBB" when targeting x86_x64
                    windows
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mike.winterberg at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 22629
  --> https://bugs.llvm.org/attachment.cgi?id=22629&action=edit
crash reproducer script

Unfortunately, since I usually just use the pre-built prereleases, I don't know
when this first occurred, aside from sometime between
LLVM-9.0.0-r363781-win64.exe and LLVM-10.0.0-r372920-win64.exe.

The x86_64-pc-linux-gnu and i386-pc-windows-msvc19.16.27034 targets do not
reproduce the assertion. -O0, -O3, -Ofast all do not reproduce the assertion.
All other -O flags do.


> clang.exe --version
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
9588ae772d6a3742e8429d86d65e3fd68f6d9444)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\mike.winterberg\llvm\llvm-project\build\bin

>type bob.cc
extern void f1();

extern void f();

void f()
{
    bool threw = false;
    try {
        f1();
    } catch (...) {
        threw = true;
    }
    if (threw) {
        f1();
        return;
    }
    try {
        f1();
    } catch (...) {
        threw = true;
    }
    if (threw) {
        f1();
        return;
    }
}

>clang++.exe -target x86_64-pc-windows-msvc19.16.27034 -c -O2 bob.cc
Assertion failed: getNumber() >= 0 && "cannot get label for unreachable MBB",
file
C:\Users\mike.winterberg\llvm\llvm-project\llvm\lib\CodeGen\MachineBasicBlock.cpp,
line 64
Stack dump:
0.      Program arguments:
C:\Users\mike.winterberg\llvm\llvm-project\build\bin\clang++.exe -cc1 -triple
x86_64-pc-windows-msvc19.16.27034 -emit-obj -mincremental-linker-compatible
-disable-free -main-file-name bob.cc -mrelocation-model pic -pic-level 2
-mthread-model posix -mframe-pointer=none -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info
-resource-dir C:\Users\mike.winterberg\llvm\llvm-project\build\lib\clang\10.0.0
-internal-isystem
C:\Users\mike.winterberg\llvm\llvm-project\build\lib\clang\10.0.0\include
-internal-isystem C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include
-internal-isystem C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include -internal-isystem
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt
-internal-isystem C:\Program Files (x86)\Windows
Kits\10\include\10.0.17763.0\shared -internal-isystem C:\Program Files
(x86)\Windows Kits\10\include\10.0.17763.0\um -internal-isystem C:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -internal-isystem
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt -O2
-fdeprecated-macro -fdebug-compilation-dir
C:\Users\mike.winterberg\llvm\llvm-project\build\bin -ferror-limit 19
-fmessage-length 190 -fno-use-cxa-atexit -fms-extensions -fms-compatibility
-fms-compatibility-version=19.16.27034 -std=c++14 -fdelayed-template-parsing
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o bob.o -x c++
bob.cc
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'bob.cc'.
4.      Running pass 'X86 Assembly Printer' on function '@"?f@@YAXXZ"'
 #0 0x00007ff6a0f30ef5 HandleAbort
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\support\windows\signals.inc:408:0
 #1 0x00007ffed647da2d (C:\Windows\System32\ucrtbase.dll+0x6da2d)
 #2 0x00007ffed647e901 (C:\Windows\System32\ucrtbase.dll+0x6e901)
 #3 0x00007ffed648031a (C:\Windows\System32\ucrtbase.dll+0x7031a)
 #4 0x00007ffed6480211 (C:\Windows\System32\ucrtbase.dll+0x70211)
 #5 0x00007ffed6480591 (C:\Windows\System32\ucrtbase.dll+0x70591)
 #6 0x00007ff6a035f8e3 llvm::MachineBasicBlock::getSymbol(void)const 
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\codegen\machinebasicblock.cpp:64:0
 #7 0x00007ff69fd28929 `anonymous
namespace'::X86MCInstLower::GetSymbolFromOperand
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\target\x86\x86mcinstlower.cpp:151:0
 #8 0x00007ff69fd2aa2d `anonymous
namespace'::X86MCInstLower::LowerMachineOperand
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\target\x86\x86mcinstlower.cpp:428:0
 #9 0x00007ff69fd28e93 `anonymous namespace'::X86MCInstLower::Lower
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\target\x86\x86mcinstlower.cpp:469:0
#10 0x00007ff69fd25488 llvm::X86AsmPrinter::EmitInstruction(class
llvm::MachineInstr const *)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\target\x86\x86mcinstlower.cpp:2314:0
#11 0x00007ff6a1ba100a llvm::AsmPrinter::EmitFunctionBody(void)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\codegen\asmprinter\asmprinter.cpp:1124:0
#12 0x00007ff69fc61fe4 llvm::X86AsmPrinter::runOnMachineFunction(class
llvm::MachineFunction &)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\target\x86\x86asmprinter.cpp:82:0
#13 0x00007ff6a0373e0b llvm::MachineFunctionPass::runOnFunction(class
llvm::Function &)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\codegen\machinefunctionpass.cpp:73:0
#14 0x00007ff6a06e9178 llvm::FPPassManager::runOnFunction(class llvm::Function
&)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\ir\legacypassmanager.cpp:1648:0
#15 0x00007ff6a06e94f0 llvm::FPPassManager::runOnModule(class llvm::Module &)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\ir\legacypassmanager.cpp:1683:0
#16 0x00007ff6a06e97df `anonymous namespace'::MPPassManager::runOnModule
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\ir\legacypassmanager.cpp:1749:0
#17 0x00007ff6a06e8857 llvm::legacy::PassManagerImpl::run(class llvm::Module &)
c:\users\mike.winterberg\llvm\llvm-project\llvm\lib\ir\legacypassmanager.cpp:1863:0
#18 0x00007ff6a12b0e7d `anonymous namespace'::EmitAssemblyHelper::EmitAssembly
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\codegen\backendutil.cpp:917:0
#19 0x00007ff6a12b44b1 clang::EmitBackendOutput(class clang::DiagnosticsEngine
&,class clang::HeaderSearchOptions const &,class clang::CodeGenOptions const
&,class clang::TargetOptions const &,class clang::LangOptions const &,class
llvm::DataLayout const &,class llvm::Module *,enum clang::BackendAction,class
std::unique_ptr<class llvm::raw_pwrite_stream,struct std::default_delete<class
llvm::raw_pwrite_stream> >)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\codegen\backendutil.cpp:1540:0
#20 0x00007ff6a40f1f23 clang::BackendConsumer::HandleTranslationUnit(class
clang::ASTContext &)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\codegen\codegenaction.cpp:311:0
#21 0x00007ff6a2cc7625 clang::ParseAST(class clang::Sema &,bool,bool)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\parse\parseast.cpp:178:0
#22 0x00007ff6a18bc115 clang::ASTFrontendAction::ExecuteAction(void)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\frontend\frontendaction.cpp:1044:0
#23 0x00007ff6a18bbe98 clang::FrontendAction::Execute(void)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\frontend\frontendaction.cpp:939:0
#24 0x00007ff6a186e240 clang::CompilerInstance::ExecuteAction(class
clang::FrontendAction &)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\frontend\compilerinstance.cpp:957:0
#25 0x00007ff6a19828cd clang::ExecuteCompilerInvocation(class
clang::CompilerInstance *)
c:\users\mike.winterberg\llvm\llvm-project\clang\lib\frontendtool\executecompilerinvocation.cpp:290:0
#26 0x00007ff69eb84887 cc1_main(class llvm::ArrayRef<char const *>,char const
*,void *)
c:\users\mike.winterberg\llvm\llvm-project\clang\tools\driver\cc1_main.cpp:251:0
#27 0x00007ff69eb7d9e5 ExecuteCC1Tool
c:\users\mike.winterberg\llvm\llvm-project\clang\tools\driver\driver.cpp:319:0
#28 0x00007ff69eb80be7 main
c:\users\mike.winterberg\llvm\llvm-project\clang\tools\driver\driver.cpp:382:0
#29 0x00007ff6a3e3c2ec __scrt_common_main_seh
d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#30 0x00007ffed6527974 (C:\Windows\System32\KERNEL32.DLL+0x17974)
#31 0x00007ffed935a271 (C:\Windows\SYSTEM32\ntdll.dll+0x6a271)
clang++: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
9588ae772d6a3742e8429d86d65e3fd68f6d9444)
Target: x86_64-pc-windows-msvc19.16.27034
Thread model: posix
InstalledDir: C:\Users\mike.winterberg\llvm\llvm-project\build\bin
clang++: 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++: note: diagnostic msg:
********************

When compiling with the nightly Debian builds:
$ clang++ --version
clang version 10.0.0-svn373519-1~exp1+0~20191002203304.314~1.gbpab8d9f (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin


$ clang++ -O2 -c -target x86_64-pc-windows-msvc19.16 bob.cc
fatal error: error in backend: assembler label '.LBB0_-1' can not be undefined

-- 
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/20191004/3f2c382f/attachment-0001.html>


More information about the llvm-bugs mailing list