Skip to content

Clang crashes with consteval in front-end #59447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
magiruuvelvet opened this issue Dec 11, 2022 · 4 comments
Closed

Clang crashes with consteval in front-end #59447

magiruuvelvet opened this issue Dec 11, 2022 · 4 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@magiruuvelvet
Copy link

magiruuvelvet commented Dec 11, 2022

# clang -v
clang version 15.0.6
Target: x86_64-pc-linux
Thread model: posix
InstalledDir: /usr/lib/llvm/current/bin
Configuration file: /etc/clang/clang.cfg
System configuration file directory: /etc/clang

Note: I self-hosted my LLVM version compiled with itself. The first stage was built using LLVM 11.0.1, which was my previous installed version.

# readelf --string-dump=.comment (which clang)
File: /usr/lib/llvm/current/bin/clang
Format: elf64-x86-64
Arch: x86_64
AddressSize: 64bit
LoadName: <Not found>
String dump of section '.comment':
[     1] Linker: LLD 15.0.6
[    14] clang version 15.0.6

I followed the instructions at https://llvm.org/docs/HowToSubmitABug.html

  1. normal compiler invocation crashes
  2. adding -emit-llvm -Xclang -disable-llvm-passes to the compiler arguments still crashed
  3. just -emit-llvm didn't crash
  4. opt -O3 foo.bc -disable-output didn't crash either
  5. compiling the produced source file using the run script file still crashes (from step 1)

Stack trace with -march=native (Intel Haswell) and -O3:

1.      <eof> parser at end of file
 #0 0x00007fdf10358a33 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e38a33)
 #1 0x00007fdf10356bd0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e36bd0)
 #2 0x00007fdf10358eda SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fdf0e0e28f0 __restore_rt sigaction.c:0:0
 #4 0x00007fdf122a6dd2 llvm::X86TTIImpl::areInlineCompatible(llvm::Function const*, llvm::Function const*) const X86TargetTransformInfo.cpp:0:0
 #5 0x00007fdf116621e5 llvm::getAttributeBasedInliningDecision(llvm::CallBase&, llvm::Function*, llvm::TargetTransformInfo&, llvm::function_ref<llvm::TargetLibraryInfo const& (llvm::Function&)>) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x31421e5)
 #6 0x00007fdf1167121a llvm::InlineAdvisor::getAdvice(llvm::CallBase&, bool) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x315121a)
 #7 0x00007fdf1137e725 llvm::InlinerPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x2e5e725)
 #8 0x00007fdf113833dd llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::InlinerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) Inliner.cpp:0:0
 #9 0x00007fdf115d7d14 llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x30b7d14)
#10 0x00007fdf113837dd llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) Inliner.cpp:0:0
#11 0x00007fdf115d9d94 llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x30b9d94)
#12 0x00007fdf11383e3d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::DevirtSCCRepeatedPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) Inliner.cpp:0:0
#13 0x00007fdf115d92f5 llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x30b92f5)
#14 0x00007fdf11383c5d llvm::detail::PassModel<llvm::Module, llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) Inliner.cpp:0:0
#15 0x00007fdf104d2c4a llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1fb2c4a)
#16 0x00007fdf1138044c llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x2e6044c)
#17 0x00007fdf125df74d llvm::detail::PassModel<llvm::Module, llvm::ModuleInlinerWrapperPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilder.cpp:0:0
#18 0x00007fdf104d2c4a llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1fb2c4a)
#19 0x00007fdf14e159f0 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>&, std::__1::unique_ptr<llvm::ToolOutputFile, std::__1::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#20 0x00007fdf14e0e7a4 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>>) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x23ff7a4)
#21 0x00007fdf15131300 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#22 0x00007fdf13fdc424 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x15cd424)
#23 0x00007fdf15a0579f clang::FrontendAction::Execute() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2ff679f)
#24 0x00007fdf15989fb6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2f7afb6)
#25 0x00007fdf15a78692 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x3069692)
#26 0x000055ec8c7d567b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm/15/bin/clang-15+0x1567b)
#27 0x000055ec8c7d3401 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#28 0x000055ec8c7d2ef6 clang_main(int, char**) (/usr/lib/llvm/15/bin/clang-15+0x12ef6)
#29 0x00007fdf0e0cd7ed __libc_start_main (/lib64/libc.so.6+0x2017ed)
#30 0x000055ec8c7d001a _start (/usr/lib/llvm/15/bin/clang-15+0x1001a)

Stack trace without -march flag and -O0:

1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      /usr/include/c++/v1/__memory/allocate_at_least.h:53:65: Generating code for declaration 'std::__allocate_at_least'
 #0 0x00007f3938410a33 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e38a33)
 #1 0x00007f393840ebd0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e36bd0)
 #2 0x00007f3938335066 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f393619a8f0 __restore_rt sigaction.c:0:0
 #4 0x00007f39361e66a9 _int_malloc malloc.c:0:0
 #5 0x00007f39361e7aa2 _int_realloc malloc.c:0:0
 #6 0x00007f39361e8d32 __libc_realloc (/lib64/libc.so.6+0x264d32)
 #7 0x00007f39383a0420 llvm::SmallVectorBase<unsigned int>::grow_pod(void*, unsigned long, unsigned long) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1dc8420)
 #8 0x00007f393834c8b2 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::Allocate(unsigned long, llvm::Align) FoldingSet.cpp:0:0
 #9 0x00007f3938439b7a llvm::AttributeList::getImpl(llvm::LLVMContext&, llvm::ArrayRef<llvm::AttributeSet>) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e61b7a)
#10 0x00007f393843ab68 llvm::AttributeList::setAttributesAtIndex(llvm::LLVMContext&, unsigned int, llvm::AttributeSet) const (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e62b68)
#11 0x00007f393843ad59 llvm::AttributeList::addAttributesAtIndex(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&) const (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1e62d59)
#12 0x00007f3938519a1b llvm::Function::addFnAttrs(llvm::AttrBuilder const&) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1f41a1b)
#13 0x00007f393d2071dc clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition(clang::Decl const*, llvm::Function*) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x27401dc)
#14 0x00007f393d211876 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x274a876)
#15 0x00007f393d20b29d clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x274429d)
#16 0x00007f393d1fff0b clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2738f0b)
#17 0x00007f393d1ffe68 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2738e68)
#18 0x00007f393d1ffe68 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2738e68)
#19 0x00007f393d1ffe68 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2738e68)
#20 0x00007f393d1fe10e clang::CodeGen::CodeGenModule::Release() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x273710e)
#21 0x00007f393d299994 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#22 0x00007f393d1e8c39 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#23 0x00007f393c094424 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x15cd424)
#24 0x00007f393dabd79f clang::FrontendAction::Execute() (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2ff679f)
#25 0x00007f393da41fb6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2f7afb6)
#26 0x00007f393db30692 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x3069692)
#27 0x0000564439ec567b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm/current/bin/clang+++0x1567b)
#28 0x0000564439ec3401 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#29 0x00007f393d71a962 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#30 0x00007f3938334daf llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm/15/bin/../lib64/libLLVM-15libcxx.so+0x1d5cdaf)
#31 0x00007f393d71a433 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2c53433)
#32 0x00007f393d6e45d7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2c1d5d7)
#33 0x00007f393d6e48de clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2c1d8de)
#34 0x00007f393d6fd55c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) (/usr/lib/llvm/15/bin/../lib64/libclang-cpp.so.15libcxx+0x2c3655c)
#35 0x0000564439ec2b60 clang_main(int, char**) (/usr/lib/llvm/current/bin/clang+++0x12b60)
#36 0x00007f39361857ed __libc_start_main (/lib64/libc.so.6+0x2017ed)
#37 0x0000564439ec001a _start (/usr/lib/llvm/current/bin/clang+++0x1001a)

My only guess is consteval. Replacing all instances with constexpr makes the crash go away.

I found the crash attempting to compile this project: https://github.com/RPCS3/rpcs3.git 0d929a210f33ea8fe18dcc3aa5291a9544b29cfc

The file https://github.com/RPCS3/rpcs3/blob/0d929a210f33ea8fe18dcc3aa5291a9544b29cfc/rpcs3/Loader/TRP.cpp is reliable to reproduce the crash on my system.

The included header file with the possible crashing consteval -> https://github.com/RPCS3/rpcs3/blob/0d929a210f33ea8fe18dcc3aa5291a9544b29cfc/rpcs3/util/types.hpp#L118 (search for __INTELLISENSE__, about line 118). Enabling #define consteval constexpr makes the crash go away. I couldn't test yet if the application still works as intended with this change.

cpp and script files: crash.zip

EDIT: Application still works as intended with this change.

@EugeneZelenko EugeneZelenko added clang Clang issues not falling into any other category crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Dec 12, 2022
@AaronBallman AaronBallman added the needs-reduction Large reproducer that should be reduced into a simpler form label Feb 22, 2023
@Fznamznon
Copy link
Contributor

Trying to compile with assertions enabled gives the following assertion:

clang-17: source/llorg/llvm-project/clang/lib/Sema/SemaExpr.cpp:17896: void RemoveNestedImmediateInvocation(clang::Sema&, clang::Sema::ExpressionEvaluation
ContextRecord&, llvm::SmallVectorTemplateCommon<llvm::PointerIntPair<clang::ConstantExpr*, 1>, void>::reverse_iterator)::ComplexRemove::RemoveImmediateInvocation(clang::Con
stantExpr*): Assertion `It != IISet.rend() && "ConstantExpr marked IsImmediateInvocation should " "be present"' failed.
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: clang-17 -cc1 -triple x86_64-pc-linux -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name TRP.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -target-feature +sse -target-feature +sse2 -target-feature +cx16 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -ggnu-pubnames -fcoverage-compilation-dir=/tmp/rpcs3 -D DATADIR=\"/usr/local/share/rpcs3\" -D GLX_GLXEXT_PROTOTYPES -D GL_GLEXT_PROTOTYPES -D HAVE_FAUDIO -D HAVE_LIBEVDEV -D HAVE_VULKAN -D HAVE_X11 -D LLVM_AVAILABLE -D SOUNDTOUCH_ALLOW_SSE -D SOUNDTOUCH_FLOAT_SAMPLES -D ST_NO_EXCEPTION_HANDLING -D USE_MULTICH_ALWAYS -D VK_USE_PLATFORM_WAYLAND_KHR -D WC_NO_HARDEN -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D NDEBUG -O0 -Wall -Werror=old-style-cast -Werror=sign-compare -Werror=reorder -Werror=return-type -Werror=overloaded-virtual -Werror=missing-noreturn -Wunused-parameter -Wignored-qualifiers -Wredundant-move -Wcast-qual -Wdeprecated-copy -Wtautological-compare -Wempty-body -Wredundant-decls -Wstrict-aliasing=1 -Werror=inconsistent-missing-override -Wno-unused-lambda-capture -Wno-unused-private-field -Wno-delete-non-virtual-dtor -Wno-unused-command-line-argument -std=gnu++20 -fdeprecated-macro -fdebug-compilation-dir=/tmp/rpcs3 -fconstexpr-steps 16777216 -ferror-limi
t 19 -pthread -stack-protector 1 -fgnuc-version=4.2.1 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ TRP-7bcd9d.cpp
1.      <eof> parser at end of file
 #0 0x00000000030ae518 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (source/llorg/llvm-project/debug/bin/clang-17+0x30ae518)
 #1 0x00000000030ac30c llvm::sys::RunSignalHandlers() (source/llorg/llvm-project/debug/bin/clang-17+0x30ac30c)
 #2 0x00000000030acc0d SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f6e6701bb20 __restore_rt sigaction.c:0:0
 #4 0x00007f6e6585837f raise (/lib64/libc.so.6+0x3737f)
 #5 0x00007f6e65842db5 abort (/lib64/libc.so.6+0x21db5)
 #6 0x00007f6e65842c89 _nl_load_domain.cold.0 loadmsgcat.c:0:0
 #7 0x00007f6e65850a76 .annobin___GI___assert_fail.end assert.c:0:0
 #8 0x0000000005212c03 (source/llorg/llvm-project/debug/bin/clang-17+0x5212c03)
 #9 0x000000000530a81e (source/llorg/llvm-project/debug/bin/clang-17+0x530a81e)
#10 0x000000000530a9ee clang::TreeTransform<RemoveNestedImmediateInvocation(clang::Sema&, clang::Sema::ExpressionEvaluationContextRecord&, std::reverse_iterator<llvm::Point
erIntPair<clang::ConstantExpr*, 1u, unsigned int, llvm::PointerLikeTypeTraits<clang::ConstantExpr*>, llvm::PointerIntPairInfo<clang::ConstantExpr*, 1u, llvm::PointerLikeTyp
eTraits<clang::ConstantExpr*>>>*>)::ComplexRemove>::TransformExprs(clang::Expr* const*, unsigned int, bool, llvm::SmallVectorImpl<clang::Expr*>&, bool*) SemaExpr.cpp:0:0
#11 0x000000000530ba85 clang::TreeTransform<RemoveNestedImmediateInvocation(clang::Sema&, clang::Sema::ExpressionEvaluationContextRecord&, std::reverse_iterator<llvm::Point
erIntPair<clang::ConstantExpr*, 1u, unsigned int, llvm::PointerLikeTypeTraits<clang::ConstantExpr*>, llvm::PointerIntPairInfo<clang::ConstantExpr*, 1u, llvm::PointerLikeTyp
eTraits<clang::ConstantExpr*>>>*>)::ComplexRemove>::TransformCXXConstructExpr(clang::CXXConstructExpr*) SemaExpr.cpp:0:0
#12 0x00000000052fd6eb clang::TreeTransform<RemoveNestedImmediateInvocation(clang::Sema&, clang::Sema::ExpressionEvaluationContextRecord&, std::reverse_iterator<llvm::Point
erIntPair<clang::ConstantExpr*, 1u, unsigned int, llvm::PointerLikeTypeTraits<clang::ConstantExpr*>, llvm::PointerIntPairInfo<clang::ConstantExpr*, 1u, llvm::PointerLikeTyp
eTraits<clang::ConstantExpr*>>>*>)::ComplexRemove>::TransformExpr(clang::Expr*) SemaExpr.cpp:0:0
#13 0x000000000528df7d clang::Sema::PopExpressionEvaluationContext() (source/llorg/llvm-project/debug/bin/clang-17+0x528df7d)
#14 0x0000000004e2f7a6 clang::ParseAST(clang::Sema&, bool, bool) (source/llorg/llvm-project/debug/bin/clang-17+0x4e2f7a6)
#15 0x000000000401f228 clang::CodeGenAction::ExecuteAction() (source/llorg/llvm-project/debug/bin/clang-17+0x401f228)
#16 0x00000000039ae7d9 clang::FrontendAction::Execute() (source/llorg/llvm-project/debug/bin/clang-17+0x39ae7d9)
#17 0x00000000039461b9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (source/llorg/llvm-project/debug/bin/clang-17+0x39461b9)
#18 0x0000000003a74029 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (source/llorg/llvm-project/debug/bin/clang-17+0x3a74029)
#19 0x0000000000b2db6b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (source/llorg/llvm-project/debug/bin/clang-17+0xb2db6b)
#20 0x0000000000b29564 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x0000000000b2ab5b clang_main(int, char**, llvm::ToolContext const&) (source/llorg/llvm-project/debug/bin/clang-17+0xb2ab5b)
#22 0x0000000000a61b71 main (source/llorg/llvm-project/debug/bin/clang-17+0xa61b71)
#23 0x00007f6e65844493 __libc_start_main (/lib64/libc.so.6+0x23493)
#24 0x0000000000b24bce _start (source/llorg/llvm-project/debug/bin/clang-17+0xb24bce)

So, this is likely the same problem as #58207 .

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed clang Clang issues not falling into any other category labels Mar 23, 2023
@llvmbot
Copy link
Member

llvmbot commented Mar 23, 2023

@llvm/issue-subscribers-clang-frontend

@Fznamznon
Copy link
Contributor

creduce gave me this

struct a {
  consteval a(const char *);
};
consteval const char *b(char *c, char *) { return c; }
#define d(ch, ...) a ch(b(#ch, __VA_ARGS__));
d(e, "") d(f, "")

So, this basically the same thing as #58207 .
https://reviews.llvm.org/D146234 helps.

@Fznamznon Fznamznon removed the needs-reduction Large reproducer that should be reduced into a simpler form label Mar 24, 2023
@Fznamznon
Copy link
Contributor

I have submitted https://reviews.llvm.org/D146234 , so let's close this one as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

5 participants