[llvm-bugs] [Bug 50408] New: WebAssembly: fatal error: error in backend: missing indirect function table symbol

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 19 14:01:33 PDT 2021


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

            Bug ID: 50408
           Summary: WebAssembly: fatal error: error in backend: missing
                    indirect function table symbol
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: sbc at chromium.org
                CC: llvm-bugs at lists.llvm.org

clang/MC will crash when compiling this code snippet for WebAssembly:

```
$ cat test.cc 
class a {
public:
  static const char *b(const char *, const char *, unsigned long long *);
};
template <typename c> using d = const char *(const char *, const char *, c *);
template <typename, int, d<unsigned long long> e>
void f(unsigned long long *g) {
  char h;
  e(reinterpret_cast<char *>(h), reinterpret_cast<char *>(h), g);
}
unsigned long long i;
void j() { f<long, 0, a::b>(&i); }

```

```
$ ../llvm-build/bin/clang++ -target wasm32-unknown-emscripten -O3 -g -c test.cc
fatal error: error in backend: missing indirect function table symbol
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ../llvm-build/bin/clang++ -target
wasm32-unknown-emscripten -O3 -g -c test.cc
1.      <eof> parser at end of file
2.      Code generation
 #0 0x00007fe0053f1363 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0x19a363)
 #1 0x00007fe0053ef0ae llvm::sys::RunSignalHandlers()
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0x1980ae)
 #2 0x00007fe0053f06dd llvm::sys::CleanupOnSignal(unsigned long)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0x1996dd)
 #3 0x00007fe00531c1e3 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
CrashRecoveryContext.cpp:0:0
 #4 0x00007fe00531c15f llvm::CrashRecoveryContext::HandleExit(int)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0xc515f)
 #5 0x00007fe0053eb757 llvm::sys::Process::Exit(int, bool)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0x194757)
 #6 0x0000000000413710
llvm::DenseMapBase<llvm::DenseMap<llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*, llvm::AliasSetTracker::ASTCallbackVHDenseMapInfo,
llvm::detail::DenseMapPair<llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*> >, llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*, llvm::AliasSetTracker::ASTCallbackVHDenseMapInfo,
llvm::detail::DenseMapPair<llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*> >::destroyAll()
(../llvm-build/bin/clang+++0x413710)
 #7 0x00007fe00532b412 llvm::report_fatal_error(llvm::Twine const&, bool)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0xd4412)
 #8 0x00007fe00532b2e6
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0xd42e6)
 #9 0x00007fe00633926e (anonymous
namespace)::WasmObjectWriter::recordRelocation(llvm::MCAssembler&,
llvm::MCAsmLayout const&, llvm::MCFragment const*, llvm::MCFixup const&,
llvm::MCValue, unsigned long&) WasmObjectWriter.cpp:0:0
#10 0x00007fe0062e0685 llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&,
llvm::MCFragment&, llvm::MCFixup const&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMMC.so.13git+0x50685)
#11 0x00007fe0062e0bb0 llvm::MCAssembler::layout(llvm::MCAsmLayout&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMMC.so.13git+0x50bb0)
#12 0x00007fe0062e12e6 llvm::MCAssembler::Finish()
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMMC.so.13git+0x512e6)
#13 0x00007fe004c623dc llvm::AsmPrinter::doFinalization(llvm::Module&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/../lib/libLLVMAsmPrinter.so.13git+0x433dc)
#14 0x00007fe006038655 llvm::FPPassManager::doFinalization(llvm::Module&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMCore.so.13git+0x235655)
#15 0x00007fe006032126 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMCore.so.13git+0x22f126)
#16 0x00007fe00886cf8a (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#17 0x00007fe008866c7c clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangCodeGen.so.13git+0xcfc7c)
#18 0x00007fe008bb5a01
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
crtstuff.c:0:0
#19 0x00007fe0030a7874 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/../lib/libclangParse.so.13git+0x36874)
#20 0x00007fe0073211f0 clang::FrontendAction::Execute()
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangFrontend.so.13git+0x12a1f0)
#21 0x00007fe007290fef
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangFrontend.so.13git+0x99fef)
#22 0x00007fe008f0c2c4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangFrontendTool.so.13git+0x42c4)
#23 0x00000000004133ee cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (../llvm-build/bin/clang+++0x4133ee)
#24 0x000000000041128d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#25 0x00007fe007012b42 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long) Job.cpp:0:0
#26 0x00007fe00531c0f7
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0xc50f7)
#27 0x00007fe007012697
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.13git+0xac697)
#28 0x00007fe006fd9e08
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.13git+0x73e08)
#29 0x00007fe006fda107
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.13git+0x74107)
#30 0x00007fe006ff5e78
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.13git+0x8fe78)
#31 0x0000000000410c15 main (../llvm-build/bin/clang+++0x410c15)
#32 0x00007fe004d8bd0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#33 0x000000000040e01a _start (../llvm-build/bin/clang+++0x40e01a)
clang-13: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
69462d4818db86cec3ed2a21a021a06b0e30ad83)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir:
/usr/local/google/home/sbc/dev/wasm/llvm-project/../llvm-build/bin
clang-13: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/test-45593c.cpp
clang-13: note: diagnostic msg: /tmp/test-45593c.sh
clang-13: 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/20210519/8998c696/attachment-0001.html>


More information about the llvm-bugs mailing list