llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.99k stars 11.95k forks source link

fatal error: error in backend: Broken function found, compilation aborted! "%incdec.ptr59 = getelementptr inbounds i8, ptr %incdec.ptr55, i64 -1" #63607

Closed rogeriosouzamoraes closed 1 year ago

rogeriosouzamoraes commented 1 year ago

source_runcript.zip

The issue happens on RHEL 8.8 (4.18.0-477.10.1.el8_8.x86_64), using Clang 16.0.6. Attached are the preprocessed source and associated run script.

Command to reproduce the issue:

$ /grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang++ -c -fpic -std=c++17 -std=c++2b -pthread -stdlib=libc++ -O3 -DNDEBUG -Wall -Werror -Wstrict-aliasing -ferror-limit=1000 -DAP_CFG -DSMDB_COMPLETE_HEADERS -DET6=ET6 -DETX=6 "-DCMG_QT_VERSION=\"MAIN_VXE_23.05.543.d000,VEngineering\"" -DLINUX2 -I/grid/cva/p4/eugene/clang_vxe/ua/3party/lz4/src -I/grid/cva/p4/eugene/clang_vxe/ua/Jupiter/smDB/src -I. -I.. -I/grid/cva/p4/eugene/clang_vxe/ap/include -I/grid/cva/p4/eugene/clang_vxe/ua/include -I/grid/cva/p4/eugene/clang_vxe/ua/3party/xlm_inst/include -MMD ../smSerialization.C
Instruction does not dominate all uses!
  %incdec.ptr59 = getelementptr inbounds i8, ptr %incdec.ptr55, i64 -1
  %incdec.ptr63 = getelementptr inbounds i8, ptr %incdec.ptr59, i64 -1
in function _ZN18smdb_serialization9smArchiversERj
fatal error: error in backend: Broken function found, compilation aborted!

Stack dump:
0.      Program arguments: /grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang++ -c -fpic -std=c++17 -std=c++2b -pthread -stdlib=libc++ -O3 -DNDEBUG -Wall -Werror -Wstrict-aliasing -ferror-limit=1000 -DAP_CFG -DSMDB_COMPLETE_HEADERS -DET6=ET6 -DETX=6 -DCMG_QT_VERSION=\"MAIN_VXE_23.05.543.d000,VEngineering\" -DLINUX2 -I/grid/cva/p4/eugene/clang_vxe/ua/3party/lz4/src -I/grid/cva/p4/eugene/clang_vxe/ua/Jupiter/smDB/src -I. -I.. -I/grid/cva/p4/eugene/clang_vxe/ap/include -I/grid/cva/p4/eugene/clang_vxe/ua/include -I/grid/cva/p4/eugene/clang_vxe/ua/3party/xlm_inst/include -MMD ../smSerialization.C
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '../smSerialization.C'.
4.      Running pass 'Module Verifier' on function '@_ZN18smdb_serialization9smArchiversERj'
 #0 0x00005563a9119a78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4072a78)
 #1 0x00005563a91187fe llvm::sys::RunSignalHandlers() (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x40717fe)
 #2 0x00005563a9087372 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) ld-temp.o:0:0
 #3 0x00005563a908728d llvm::CrashRecoveryContext::HandleExit(int) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x3fe028d)
 #4 0x00005563a9113149 (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x406c149)
 #5 0x00005563a7aaba0f (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x2a04a0f)
 #6 0x00005563a908d95a llvm::report_fatal_error(llvm::Twine const&, bool) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x3fe695a)
 #7 0x00005563a908d7c6 (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x3fe67c6)
 #8 0x00005563a8967fa4 (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x38c0fa4)
 #9 0x00005563a88c1834 llvm::FPPassManager::runOnFunction(llvm::Function&) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x381a834)
#10 0x00005563a88cd512 llvm::FPPassManager::runOnModule(llvm::Module&) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x3826512)
#11 0x00005563a88c6210 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x381f210)
#12 0x00005563a9a89ccf clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x49e2ccf)
#13 0x00005563a9faa8b8 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) ld-temp.o:0:0
#14 0x00005563ab905233 clang::ParseAST(clang::Sema&, bool, bool) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x685e233)
#15 0x00005563a9ec1a7a clang::FrontendAction::Execute() (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4e1aa7a)
#16 0x00005563a9e2921d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4d8221d)
#17 0x00005563a9fa24e0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4efb4e0)
#18 0x00005563a7aaafc5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x2a03fc5)
#19 0x00005563a7a295b5 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) ld-temp.o:0:0
#20 0x00005563a9c37252 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_0>(long) ld-temp.o:0:0
#21 0x00005563a9087226 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x3fe0226)
#22 0x00005563a9c370fc clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4b900fc)
#23 0x00005563a9bee818 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4b47818)
#24 0x00005563a9beeb5e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4b47b5e)
#25 0x00005563a9c30070 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x4b89070)
#26 0x00005563a7a281dc clang_main(int, char**) (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x29811dc)
#27 0x00007fced1e21d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#28 0x00005563a7a192ae _start (/grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin/clang+++0x29722ae)
clang-16: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Cadence clang version 16.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /grid/common/test/llvm-v16.0.6d1rh84_lnx86/bin
nikic commented 1 year ago

I can reproduce this on clang 16, but not on main, so this appears to be fixed.