Skip to content
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

Bug: compile crashed on clang-15 -std=c++20 #60844

Closed
raidenluikang opened this issue Feb 17, 2023 · 8 comments
Closed

Bug: compile crashed on clang-15 -std=c++20 #60844

raidenluikang opened this issue Feb 17, 2023 · 8 comments
Labels
c++20 clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@raidenluikang
Copy link

raidenluikang commented Feb 17, 2023

Code: https://godbolt.org/z/6bsq6cocz

#include <stddef.h>
#include <utility>

template < size_t N >
struct string_literal final
{
     const char value[ N ];

     template< size_t ... index >
     consteval explicit string_literal(const char(&str)[N] ,  std::index_sequence<index ... > ) noexcept
     : value{ str[ index ] ... }
     {}


     consteval explicit string_literal(const char(&str)[N]) noexcept
     : string_literal(str, std::make_index_sequence<N>{})
     {}

};
template <string_literal>
struct value{};

#include <stdio.h>

int main(){
    constexpr string_literal literal {"hello world"};
    value<literal> v;
    value<string_literal{"hi"}> v2;
    puts(literal.value);
    puts(string_literal{"hi"}.value);
}
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-15.0.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-12.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O2 -std=c++20 <source>
1.	<eof> parser at end of file
2.	<source>:27:5: LLVM IR generation of declaration 'main'
3.	<source>:27:5: Generating code for declaration 'main'
 #0 0x0000560169b61f84 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000560169b5fdac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x38c8dac)
 #2 0x0000560169a9dbe8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f3a90b14420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x0000560169f7ee93 clang::CodeGen::ConstantEmitter::tryEmitPrivate(clang::APValue const&, clang::QualType) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3ce7e93)
 #5 0x0000560169f8021b clang::CodeGen::ConstantEmitter::tryEmitConstantExpr(clang::ConstantExpr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3ce921b)
 #6 0x000056016a2f4c82 (anonymous namespace)::AggExprEmitter::Visit(clang::Expr*) CGExprAgg.cpp:0:0
 #7 0x000056016a2f6dd9 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x405fdd9)
 #8 0x000056016a2e395c clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(clang::Expr const*, clang::CodeGen::Address, clang::Qualifiers, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x404c95c)
 #9 0x000056016a2e940c clang::CodeGen::CodeGenFunction::EmitMaterializeTemporaryExpr(clang::MaterializeTemporaryExpr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x405240c)
#10 0x000056016a2ddac3 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4046ac3)
#11 0x000056016a2e7397 clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*, clang::CodeGen::CodeGenFunction::TypeCheckKind) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4050397)
#12 0x000056016a2e77c2 clang::CodeGen::CodeGenFunction::EmitMemberExpr(clang::MemberExpr const*) (.part.0) CGExpr.cpp:0:0
#13 0x000056016a2e8966 clang::CodeGen::CodeGenFunction::EmitMemberExpr(clang::MemberExpr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4051966)
#14 0x000056016a2dda9d clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4046a9d)
#15 0x000056016a2dfb0b clang::CodeGen::CodeGenFunction::EmitArrayToPointerDecay(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4048b0b)
#16 0x000056016a32fa07 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#17 0x000056016a327c09 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#18 0x000056016a329197 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4092197)
#19 0x000056016a2caff6 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4033ff6)
#20 0x000056016a2cb56d clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x403456d)
#21 0x000056016a26464f clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&, clang::Expr const*, clang::QualType) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3fcd64f)
#22 0x000056016a26bb0b clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&, clang::CodeGen::CodeGenFunction::PrototypeWrapper, llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const* const, clang::Stmt const* const>>, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3fd4b0b)
#23 0x000056016a2db6a8 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x40446a8)
#24 0x000056016a2ea546 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4053546)
#25 0x000056016a3336e7 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#26 0x000056016a326ad0 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#27 0x000056016a326bd8 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#28 0x000056016a329197 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4092197)
#29 0x000056016a2caff6 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4033ff6)
#30 0x000056016a2e8859 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4051859)
#31 0x0000560169fa1ec3 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3d0aec3)
#32 0x0000560169fa7eea clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3d10eea)
#33 0x000056016a00549d clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3d6e49d)
#34 0x000056016a011d3d clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3d7ad3d)
#35 0x000056016a0674d7 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3dd04d7)
#36 0x000056016a063c05 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3dccc05)
#37 0x000056016a0641ab clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3dcd1ab)
#38 0x000056016a06bc0a clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#39 0x000056016ad811b1 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#40 0x000056016ad7419d clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4add19d)
#41 0x000056016bf4b0a4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x5cb40a4)
#42 0x000056016ad7ecc5 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4ae7cc5)
#43 0x000056016a6871d1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x43f01d1)
#44 0x000056016a60eed3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x4377ed3)
#45 0x000056016a765adb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x44ceadb)
#46 0x00005601674bcb64 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x1225b64)
#47 0x00005601674b610b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#48 0x000056016a478969 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#49 0x0000560169a9dce7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x3806ce7)
#50 0x000056016a478f5c clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#51 0x000056016a442fce clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x41abfce)
#52 0x000056016a4439ed clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x41ac9ed)
#53 0x000056016a44e83c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x41b783c)
#54 0x00005601674ba8e9 clang_main(int, char**) (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x12238e9)
#55 0x00007f3a905c2083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#56 0x00005601674b5d1e _start (/opt/compiler-explorer/clang-15.0.0/bin/clang+++0x121ed1e)
clang-15: error: clang frontend command failed with exit code 139 (use -v to see invocation)
ASM generation compiler returned: 139
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-15.0.0/bin/clang-15 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-15.0.0/lib/clang/15.0.0 -internal-isystem /opt/compiler-explorer/gcc-12.2.0/lib/gcc/x86_64-linux-gnu/12.2.0/../../../../include/c++/12.2.0 -internal-isystem /opt/compiler-explorer/gcc-12.2.0/lib/gcc/x86_64-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-12.2.0/lib/gcc/x86_64-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward -internal-isystem /opt/compiler-explorer/clang-15.0.0/lib/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-12.2.0/lib/gcc/x86_64-linux-gnu/12.2.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=/app -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-0eabc5.o -x c++ <source>
1.	<eof> parser at end of file
2.	<source>:27:5: LLVM IR generation of declaration 'main'
3.	<source>:27:5: Generating code for declaration 'main'
 #0 0x000055e1e76dcf84 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055e1e76da7e4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fce2390d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x000055e1e7af9e93 clang::CodeGen::ConstantEmitter::tryEmitPrivate(clang::APValue const&, clang::QualType) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3ce7e93)
 #4 0x000055e1e7afb21b clang::CodeGen::ConstantEmitter::tryEmitConstantExpr(clang::ConstantExpr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3ce921b)
 #5 0x000055e1e7e6fc82 (anonymous namespace)::AggExprEmitter::Visit(clang::Expr*) CGExprAgg.cpp:0:0
 #6 0x000055e1e7e71dd9 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x405fdd9)
 #7 0x000055e1e7e5e95c clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(clang::Expr const*, clang::CodeGen::Address, clang::Qualifiers, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x404c95c)
 #8 0x000055e1e7e6440c clang::CodeGen::CodeGenFunction::EmitMaterializeTemporaryExpr(clang::MaterializeTemporaryExpr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x405240c)
 #9 0x000055e1e7e58ac3 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4046ac3)
#10 0x000055e1e7e62397 clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*, clang::CodeGen::CodeGenFunction::TypeCheckKind) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4050397)
#11 0x000055e1e7e627c2 clang::CodeGen::CodeGenFunction::EmitMemberExpr(clang::MemberExpr const*) (.part.0) CGExpr.cpp:0:0
#12 0x000055e1e7e63966 clang::CodeGen::CodeGenFunction::EmitMemberExpr(clang::MemberExpr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4051966)
#13 0x000055e1e7e58a9d clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4046a9d)
#14 0x000055e1e7e5ab0b clang::CodeGen::CodeGenFunction::EmitArrayToPointerDecay(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4048b0b)
#15 0x000055e1e7eaaa07 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#16 0x000055e1e7ea2c09 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#17 0x000055e1e7ea4197 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4092197)
#18 0x000055e1e7e45ff6 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4033ff6)
#19 0x000055e1e7e4656d clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x403456d)
#20 0x000055e1e7ddf64f clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&, clang::Expr const*, clang::QualType) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3fcd64f)
#21 0x000055e1e7de6b0b clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&, clang::CodeGen::CodeGenFunction::PrototypeWrapper, llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const* const, clang::Stmt const* const>>, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3fd4b0b)
#22 0x000055e1e7e566a8 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x40446a8)
#23 0x000055e1e7e65546 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4053546)
#24 0x000055e1e7eae6e7 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#25 0x000055e1e7ea1ad0 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#26 0x000055e1e7ea1bd8 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#27 0x000055e1e7ea4197 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4092197)
#28 0x000055e1e7e45ff6 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4033ff6)
#29 0x000055e1e7e63859 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4051859)
#30 0x000055e1e7b1cec3 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3d0aec3)
#31 0x000055e1e7b22eea clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3d10eea)
#32 0x000055e1e7b8049d clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3d6e49d)
#33 0x000055e1e7b8cd3d clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3d7ad3d)
#34 0x000055e1e7be24d7 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3dd04d7)
#35 0x000055e1e7bdec05 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3dccc05)
#36 0x000055e1e7bdf1ab clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x3dcd1ab)
#37 0x000055e1e7be6c0a clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#38 0x000055e1e88fc1b1 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#39 0x000055e1e88ef19d clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4add19d)
#40 0x000055e1e9ac60a4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x5cb40a4)
#41 0x000055e1e88f9cc5 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4ae7cc5)
#42 0x000055e1e82021d1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x43f01d1)
#43 0x000055e1e8189ed3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x4377ed3)
#44 0x000055e1e82e0adb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x44ceadb)
#45 0x000055e1e5037b64 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x1225b64)
#46 0x000055e1e503110b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#47 0x000055e1e50336f0 clang_main(int, char**) (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x12216f0)
#48 0x00007fce233bb083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#49 0x000055e1e5030d1e _start (/opt/compiler-explorer/clang-15.0.0/bin/clang-15+0x121ed1e)
clang-15: error: unable to execute command: Segmentation fault (core dumped)
clang-15: error: clang frontend command failed due to signal (use -v to see invocation)
Execution build compiler returned: 254
@EugeneZelenko EugeneZelenko added c++20 clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Feb 17, 2023
@llvmbot
Copy link
Member

llvmbot commented Feb 17, 2023

@llvm/issue-subscribers-clang-codegen

@llvmbot
Copy link
Member

llvmbot commented Feb 17, 2023

@llvm/issue-subscribers-c-20

@EugeneZelenko
Copy link
Contributor

Could you please try 16 or main branch? https://godbolt.org should be helpful.

@raidenluikang
Copy link
Author

Yes, on clang-trunk it worked.

Or on clang-15 change to string_literal("hi") expression also worked.

@EugeneZelenko
Copy link
Contributor

16 is only currently supported release.

@raidenluikang
Copy link
Author

Ok, no problem.

I also tested with clang-15.0.7 latest clang-15 version locally, it also crashed.

There is not planned bug fix to clang-15 ?

@EugeneZelenko
Copy link
Contributor

I don't think so. But please make sure that 16 release candidates are fine for you.

@AaronBallman
Copy link
Collaborator

I believe this has been fixed on trunk, so closing the issue. If the issue does still reproduce for you with Clang 16, please reopen the issue with more details. (We're not planning to put out any further releases to 15.x at this time.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants