<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/118725>118725</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            SIGSEGV with -flto
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          illiminable
      </td>
    </tr>
</table>

<pre>
    Static linking with -flto on Arch linux with clang 18.1.8

Not able to get a minimal repro at the moment. Other possibly less common options

      "-std=c++20",
      "-nostdlib",
 "-nostartfiles",
      "-fno-exceptions",
 "-fno-rtti",

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ee06170e69c in llvm::ConstantFoldConstant(llvm::Constant const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) () from /usr/lib/libLLVM.so.18.1
#0  0x00007ee06170e69c in llvm::ConstantFoldConstant(llvm::Constant const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) () from /usr/lib/libLLVM.so.18.1
#1 0x00007ee060abea1a in llvm::Evaluator::EvaluateBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, false>, llvm::BasicBlock*&, bool&) () from /usr/lib/libLLVM.so.18.1
#2  0x00007ee060ac14e4 in llvm::Evaluator::EvaluateFunction(llvm::Function*, llvm::Constant*&, llvm::SmallVectorImpl<llvm::Constant*> const&) () from /usr/lib/libLLVM.so.18.1
#3  0x00007ee061307930 in ?? () from /usr/lib/libLLVM.so.18.1
#4  0x00007ee061308634 in ?? () from /usr/lib/libLLVM.so.18.1
#5  0x00007ee060aa7649 in llvm::optimizeGlobalCtorsList(llvm::Module&, llvm::function_ref<bool (unsigned int, llvm::Function*)>) () from /usr/lib/libLLVM.so.18.1
#6 0x00007ee0613135f9 in llvm::GlobalOptPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /usr/lib/libLLVM.so.18.1
#7 0x00007ee06411d177 in ?? () from /usr/lib/libLLVM.so.18.1
#8 0x00007ee05fbd767e in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /usr/lib/libLLVM.so.18.1
#9 0x00007ee061a57995 in ?? () from /usr/lib/libLLVM.so.18.1
#10 0x00007ee061a591ff in llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector<unsigned char, std::allocator<unsigned char> > const&) () from /usr/lib/libLLVM.so.18.1
#11 0x00007ee061a5a582 in llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) () from /usr/lib/libLLVM.so.18.1
#12 0x00007ee061a4ed49 in llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)>) () from /usr/lib/libLLVM.so.18.1
#13 0x00007ee061a4f241 in llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)> > (unsigned int, llvm::StringRef, llvm::Twine const&)>) () from /usr/lib/libLLVM.so.18.1
#14 0x00007ee0678ce067 in ?? () from /usr/bin/../lib/LLVMgold.so
#15 0x00007ee0678cfd12 in ?? () from /usr/bin/../lib/LLVMgold.so
#16 0x000056f827567837 in ?? ()
#17 0x000056f82756f75f in ?? ()
#18 0x00007ee067a00e08 in ?? () from /usr/lib/libc.so.6
#19 0x00007ee067a00ecc in __libc_start_main () from /usr/lib/libc.so.6
#20 0x000056f82756ea65 in ?? ()

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWMtu2zgU_Rp6Q8SgSD0XXjhOXARIpkVddGtQ1JXMKUV6SCqP-foBZcWx7DbNYwYYJEgshffyiOfcw4fFnZONBpih5BwlFxPe-Y2xM6mUbKXmpYJJaaqH2cpzLwVWUv-QusF30m_wWa28wUbjuRWbEOrudwGhuG5wlE-jaY7IHJH5H8bjAIa9wQ14zHErtWy5wha21mDusd8Abk0L2k_xZ78Bi7fGOVmqB6zAOSxM2xqNzdZLo90OFvc_iNIz5yvELgSi54ieU4IoRXQxytDG-UrJ8in02Mqtr6UC95NOtTZncC9geOioa4hZ7-W-FZH5F2say1vswQb5PFQ7RYLIXOHV1afV5afviC7wCprAlQdgXPNO-WmAoIxgTO4JISQDIGmUEUgLgaXGSt22iM0Rmy-Mdp5rvzSqerxHND9NwCLcIDoPT3wKX3DPr_mD6fYJ6TjhG7cN-GtZWm4frnRtDoAKjGgeLrU1LUZ02TmL6LJXNnxeX3-_mTozDeX_qIyiQ0KEl8AjPiZ0ectVx72xo3_hXBnxY0RMKun8WnqwIXt9ty6ld4gtjjMq8FyqXYs2FawfJ8Jh6pV23nYiBAL9misHo5tbI6tw9bYDxC5_krRrfII8506KYdjzQdbSGNXfvl45isfSiSiG-EXSLTs9EDtQ76nxyBBPJpqfeGHVcqW-g_DGXrVbNVLwsB-7PDDT66myse0ZyQpGAlXElogtX40XH-PlKYvfgZcclYJnaVyMSxE81sq_4ZMyJVcLb6y7lm48M29M1Sk4EbkeKrO2UCO2CJYJI-x0v99UWAaNDzuMSln0Pny95ulYoogl9RGlHZXPW_-FO7drsp1-CaO55urBSXfDNW_AjmwzdAmDfpNXssNxx1FURVn2jtLmB3BJXVZZmsFYhsD-GSJvIB5-_ydqFiMX8CQriuQdakbkCK-I6nosp_JmP2NG7PeBhdG1bJ7dn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