Issue 147659
Summary [LLVM] Crash when running with print-changed=dot-cfg using release build
Labels new issue
Assignees
Reporter 5c4lar
    The configuration --print-changed=dot-cfg does not work for release build of llvm, but when built with Debug mode or enabling the assertions, it works fine. Is this the intended behaviour or how can I find the root cause? It seems that the name of the entry block is not correctly collected if the assertion is turned off.
```
Stack dump:
0. Program arguments: clang -c -O2 test/src/dirchownmod.c -mllvm --print-changed=dot-cfg -disable-output
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x000077cc148443bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0x000077cc148424f9 llvm::sys::RunSignalHandlers() build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Signals.cpp:106:18
 #2 0x000077cc1478e227 HandleCrash build-llvm/tools/clang/stage2-bins/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
 #3 0x000077cc1478e227 CrashRecoverySignalHandler build-llvm/tools/clang/stage2-bins/llvm/lib/Support/CrashRecoveryContext.cpp:390:51
 #4 0x000077cc13636330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #5 0x000077cc17a2b9dc _M_data /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:223:28
 #6 0x000077cc17a2b9dc data /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:2609:16
 #7 0x000077cc17a2b9dc StringRef build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/StringRef.h:101:18
 #8 0x000077cc17a2b9dc getEdgeSourceLabel build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:1780:12
 #9 0x000077cc17a2b9dc createDisplayEdges build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:2005:29
#10 0x000077cc17a2b9dc createDisplayGraph build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:1989:25
#11 0x000077cc17a2b9dc llvm::DotCfgChangeReporter::handleFunctionCompare(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, unsigned int, llvm::FuncDataT<llvm::DCData> const&, llvm::FuncDataT<llvm::DCData> const&) build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:2162:36
#12 0x000077cc17a3a82b _M_invoke /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290:2
#13 0x000077cc17a3a783 callback_fn<(lambda at llvm/lib/Passes/StandardInstrumentations.cpp:649:22)> build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#14 0x000077cc17a3a535 operator() build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#15 0x000077cc17a3a535 llvm::OrderedChangedData<llvm::FuncDataT<llvm::DCData>>::report(llvm::OrderedChangedData<llvm::FuncDataT<llvm::DCData>> const&, llvm::OrderedChangedData<llvm::FuncDataT<llvm::DCData>> const&, llvm::function_ref<void (llvm::FuncDataT<llvm::DCData> const*, llvm::FuncDataT<llvm::DCData> const*)>) build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:616:5
#16 0x000077cc17a2eac4 _M_data /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:223:28
#17 0x000077cc17a2eac4 _M_is_local /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:264:6
#18 0x000077cc17a2eac4 _M_dispose /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:282:7
#19 0x000077cc17a2eac4 ~basic_string /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:804:9
#20 0x000077cc17a2eac4 ~FuncDataT build-llvm/tools/clang/stage2-bins/llvm/include/llvm/Passes/StandardInstrumentations.h:371:7
#21 0x000077cc17a2eac4 llvm::IRComparer<llvm::DCData>::compare(bool, std::function<void (bool, unsigned int, llvm::FuncDataT<llvm::DCData> const&, llvm::FuncDataT<llvm::DCData> const&)>) build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:657:1
#22 0x000077cc17a2e730 ~_Function_base /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:243:11
#23 0x000077cc17a2e730 llvm::DotCfgChangeReporter::handleInitialIR(llvm::Any) build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:2201:3
#24 0x000077cc17a3ab81 ~unique_ptr /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:403:6
#25 0x000077cc17a3ab81 ~Any build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/Any.h:28:32
#26 0x000077cc17a3ab81 llvm::ChangeReporter<llvm::IRDataT<llvm::DCData>>::saveIRBeforePass(llvm::Any, llvm::StringRef, llvm::StringRef) build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:362:7
#27 0x000077cc17a3aacc ~unique_ptr /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:403:6
#28 0x000077cc17a3aacc ~Any build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/Any.h:28:32
#29 0x000077cc17a3aacc operator() build-llvm/tools/clang/stage2-bins/llvm/lib/Passes/StandardInstrumentations.cpp:425:5
#30 0x000077cc17a3aacc CallImpl<(lambda at llvm/lib/Passes/StandardInstrumentations.cpp:424:44)> build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/FunctionExtras.h:221:12
#31 0x000077cc149cc5a9 ~unique_ptr /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:403:6
#32 0x000077cc149cc5a9 ~Any build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/Any.h:28:32
#33 0x000077cc149cc5a9 runBeforePass<llvm::Module, llvm::detail::PassConcept<llvm::Module, llvm::AnalysisManager<llvm::Module> > > build-llvm/tools/clang/stage2-bins/llvm/include/llvm/IR/PassInstrumentation.h:241:9
#34 0x000077cc149cc22f llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) build-llvm/tools/clang/stage2-bins/llvm/include/llvm/IR/PassManager.h:540:11
#35 0x000077cc1ccc8590 isSmall build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/SmallPtrSet.h:195:33
#36 0x000077cc1ccc8590 ~SmallPtrSetImplBase build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/SmallPtrSet.h:83:10
#37 0x000077cc1ccc8590 ~PreservedAnalyses build-llvm/tools/clang/stage2-bins/llvm/include/llvm/IR/PassManager.h:172:7
#38 0x000077cc1ccc8590 RunOptimizationPipeline build-llvm/tools/clang/stage2-bins/clang/lib/CodeGen/BackendUtil.cpp:1101:5
#39 0x000077cc1ccbfef3 EmitAssembly build-llvm/tools/clang/stage2-bins/clang/lib/CodeGen/BackendUtil.cpp:0:3
#40 0x000077cc1ccbfef3 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>>, clang::BackendConsumer*) build-llvm/tools/clang/stage2-bins/clang/lib/CodeGen/BackendUtil.cpp:1328:13
#41 0x000077cc1d048a07 ~unique_ptr /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:403:6
#42 0x000077cc1d048a07 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) build-llvm/tools/clang/stage2-bins/clang/lib/CodeGen/CodeGenAction.cpp:379:3
#43 0x000077cc1bc403d6 __normal_iterator /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
#44 0x000077cc1bc403d6 begin /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:874:16
#45 0x000077cc1bc403d6 finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback> >, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback> > > > > build-llvm/tools/clang/stage2-bins/clang/include/clang/Sema/TemplateInstCallback.h:54:16
#46 0x000077cc1bc403d6 clang::ParseAST(clang::Sema&, bool, bool) build-llvm/tools/clang/stage2-bins/clang/lib/Parse/ParseAST.cpp:183:3
#47 0x000077cc1daaf62c clang::FrontendAction::Execute() build-llvm/tools/clang/stage2-bins/clang/lib/Frontend/FrontendAction.cpp:1073:10
#48 0x000077cc1da2c0b4 getPtr build-llvm/tools/clang/stage2-bins/llvm/include/llvm/Support/Error.h:279:12
#49 0x000077cc1da2c0b4 operator bool build-llvm/tools/clang/stage2-bins/llvm/include/llvm/Support/Error.h:239:16
#50 0x000077cc1da2c0b4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) build-llvm/tools/clang/stage2-bins/clang/lib/Frontend/CompilerInstance.cpp:1057:23
#51 0x000077cc1db2b63d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) build-llvm/tools/clang/stage2-bins/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:25
#52 0x000062c40e6b542e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) build-llvm/tools/clang/stage2-bins/clang/tools/driver/cc1_main.cpp:294:15
#53 0x000062c40e6b2894 ExecuteCC1Tool build-llvm/tools/clang/stage2-bins/clang/tools/driver/driver.cpp:365:12
#54 0x000077cc1d6dc972 operator() build-llvm/tools/clang/stage2-bins/clang/lib/Driver/Job.cpp:440:30
#55 0x000077cc1d6dc972 callback_fn<(lambda at clang/lib/Driver/Job.cpp:440:22)> build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#56 0x000077cc1478df77 operator() build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#57 0x000077cc1478df77 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/CrashRecoveryContext.cpp:426:3
#58 0x000077cc1d6dc237 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const build-llvm/tools/clang/stage2-bins/clang/lib/Driver/Job.cpp:440:7
#59 0x000077cc1d6a4518 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const build-llvm/tools/clang/stage2-bins/clang/lib/Driver/Compilation.cpp:199:15
#60 0x000077cc1d6a477f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const build-llvm/tools/clang/stage2-bins/clang/lib/Driver/Compilation.cpp:253:13
#61 0x000077cc1d6c0c20 empty build-llvm/tools/clang/stage2-bins/llvm/include/llvm/ADT/SmallVector.h:94:46
#62 0x000077cc1d6c0c20 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) build-llvm/tools/clang/stage2-bins/clang/lib/Driver/Driver.cpp:1921:23
#63 0x000062c40e6b21ec clang_main(int, char**, llvm::ToolContext const&) build-llvm/tools/clang/stage2-bins/clang/tools/driver/driver.cpp:540:21
#64 0x000062c40e6bf383 main build-llvm/tools/clang/stage2-bins/build-llvm/tools/clang/stage2-bins/tools/clang/tools/driver/clang-driver.cpp:17:10
#65 0x000077cc1361b1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#66 0x000077cc1361b28b call_init ./csu/../csu/libc-start.c:128:20
#67 0x000077cc1361b28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#68 0x000062c40e6af255 _start (/usr/lib/llvm-18/bin/clang+0xe255)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/dirchownmod-f0fb82.c
clang: note: diagnostic msg: /tmp/dirchownmod-f0fb82.sh
clang: note: diagnostic msg: 

********************
```
[reproduce_files.zip](https://github.com/user-attachments/files/21135882/reproduce_files.zip)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to