llvm-project
llvm-project copied to clipboard
`clangtk`: fatal error: error in backend: Broken function found, compilation aborted!
The testcase:
struct a;
void b(void) {}
__attribute__((interrupt))
void c(struct a *d) { b(); }
When compile it using clangtk with option -O0, clangtk reports fatal errors in backend (verification link: https://gcc.godbolt.org/z/Pb1GvvKdY):
The output log copied from gcc.godbolt.org:
<source>:4:23: warning: interrupt service routine should only call a function with attribute 'no_caller_saved_registers' [-Winterrupt-service-routine]
4 | void c(struct a *d) { b(); }
| ^
<source>:2:6: note: 'b' declared here
2 | void b(void) {}
| ^
Attribute 'byval' does not support unsized types!
ptr @c
in function c
fatal error: error in backend: Broken function found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '<source>'.
4. Running pass 'Module Verifier' on function '@c'
#0 0x000055d3ee35393f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c5293f)
#1 0x000055d3ee3516ac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c506ac)
#2 0x000055d3ee29c36a llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b9b36a)
#3 0x000055d3ee3488c2 llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c478c2)
#4 0x000055d3eb7f5b7a LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#5 0x000055d3ee2a6f5a llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ba5f5a)
#6 0x000055d3ee2a70ee (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ba60ee)
#7 0x000055d3edd5ca46 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) Verifier.cpp:0:0
#8 0x000055d3edcbd841 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35bc841)
#9 0x000055d3edcbda89 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35bca89)
#10 0x000055d3edcbe302 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35bd302)
#11 0x000055d3ee5d1883 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ed0883)
#12 0x000055d3ef5cb70d clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4eca70d)
#13 0x000055d3f0ac56f9 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c46f9)
#14 0x000055d3ef5c9ec8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ec8ec8)
#15 0x000055d3eee14799 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4713799)
#16 0x000055d3eed9a0e6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x46990e6)
#17 0x000055d3eeef8eb6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47f7eb6)
#18 0x000055d3eb7f702d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f602d)
#19 0x000055d3eb7f2d2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#20 0x000055d3eebfa7ed void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#21 0x000055d3ee29c2a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b9b2a0)
#22 0x000055d3eebfae0f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#23 0x000055d3eebc1f7c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c0f7c)
#24 0x000055d3eebc2a0d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c1a0d)
#25 0x000055d3eebcaaed clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c9aed)
#26 0x000055d3eb7f528a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f428a)
#27 0x000055d3eb6fb5a5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xffa5a5)
#28 0x00007fb77cc9d083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x000055d3eb7edb0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10ecb0e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
@llvm/issue-subscribers-clang-codegen