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

Crash on va_arg with variable size type #106174

Open
hnarkaytis opened this issue Aug 27, 2024 · 3 comments
Open

Crash on va_arg with variable size type #106174

hnarkaytis opened this issue Aug 27, 2024 · 3 comments
Labels
clang:codegen confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@hnarkaytis
Copy link

hnarkaytis commented Aug 27, 2024

x86-64 clang (trunk)

#include <stdarg.h>

void * foo (int size, ...)
{
  va_list va_args;
  __builtin_va_start (va_args, size);
  void * ptr = __builtin_va_arg (va_args, char[size]);
  __builtin_va_end (va_args);
  return (ptr);
}

int main ()
{
  foo (sizeof (0), 0);
  return (0);
}
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-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O1 <source>
1.	<source>:12:1: current parser token 'int'
2.	<source>:3:8: LLVM IR generation of declaration 'foo'
3.	<source>:3:8: Generating code for declaration 'foo'
 #0 0x000000000387c138 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x387c138)
 #1 0x000000000387a2a4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x387a2a4)
 #2 0x00000000037c4988 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007b6690e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000003febbe5 clang::CodeGen::CodeGenFunction::EmitAggregateCopy(clang::CodeGen::LValue, clang::CodeGen::LValue, clang::QualType, clang::CodeGen::AggValueSlot::Overlap_t, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3febbe5)
 #5 0x0000000003fec905 (anonymous namespace)::AggExprEmitter::EmitCopy(clang::QualType, clang::CodeGen::AggValueSlot const&, clang::CodeGen::AggValueSlot const&) (.isra.0) CGExprAgg.cpp:0:0
 #6 0x0000000003fed7b5 (anonymous namespace)::AggExprEmitter::EmitFinalDestCopy(clang::QualType, clang::CodeGen::LValue const&, clang::CodeGen::CodeGenFunction::ExprValueKind) CGExprAgg.cpp:0:0
 #7 0x0000000003fee223 clang::CodeGen::CodeGenFunction::EmitAggFinalDestCopy(clang::QualType, clang::CodeGen::AggValueSlot, clang::CodeGen::LValue const&, clang::CodeGen::CodeGenFunction::ExprValueKind) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fee223)
 #8 0x0000000003fcf98f clang::CodeGen::CodeGenFunction::EmitLoadOfAnyValue(clang::CodeGen::LValue, clang::CodeGen::AggValueSlot, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fcf98f)
 #9 0x0000000003d72fb0 (anonymous namespace)::X86_64ABIInfo::EmitVAArg(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType, clang::CodeGen::AggValueSlot) const X86.cpp:0:0
#10 0x0000000003f3dad0 clang::CodeGen::CodeGenFunction::EmitVAArg(clang::VAArgExpr*, clang::CodeGen::Address&, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f3dad0)
#11 0x0000000003ff13c8 (anonymous namespace)::AggExprEmitter::Visit(clang::Expr*) CGExprAgg.cpp:0:0
#12 0x0000000003ff1ed9 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3ff1ed9)
#13 0x0000000003ff2b7d clang::CodeGen::CodeGenFunction::EmitAggExprToLValue(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3ff2b7d)
#14 0x0000000003fd5016 clang::CodeGen::CodeGenFunction::EmitLValueHelper(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fd5016)
#15 0x0000000003fd8925 clang::CodeGen::CodeGenFunction::EmitArrayToPointerDecay(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fd8925)
#16 0x000000000403456b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#17 0x000000000402caa2 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#18 0x000000000402e49b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#19 0x0000000004032f5b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#20 0x000000000402caa2 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#21 0x0000000004031622 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4031622)
#22 0x0000000003f8aefb clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f8aefb)
#23 0x0000000003f8c2e3 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f8c2e3)
#24 0x0000000003f9487b clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f9487b)
#25 0x0000000003f9a9fc clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#26 0x0000000003f9aac8 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f9aac8)
#27 0x0000000003bae39f clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bae39f)
#28 0x0000000003bc2cfa clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bc2cfa)
#29 0x0000000003bbbb72 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bbbb72)
#30 0x0000000003bc27a9 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bc27a9)
#31 0x0000000003c2a2ba clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c2a2ba)
#32 0x0000000003c371f8 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c371f8)
#33 0x0000000003c915bb clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c915bb)
#34 0x0000000003c8ce25 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c8ce25)
#35 0x0000000003c8d7b0 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c8d7b0)
#36 0x0000000003c96e97 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#37 0x00000000041580ae (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#38 0x0000000004149bc9 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4149bc9)
#39 0x00000000061048f4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x61048f4)
#40 0x0000000004155ec5 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x4155ec5)
#41 0x00000000043fd3b1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x43fd3b1)
#42 0x000000000437fb8b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x437fb8b)
#43 0x00000000044e48f3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x44e48f3)
#44 0x0000000000cb4ccc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb4ccc)
#45 0x0000000000caec0d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#46 0x000000000419f189 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#47 0x00000000037c4db3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x37c4db3)
#48 0x000000000419f3a9 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#49 0x0000000004164f47 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x4164f47)
#50 0x00000000041658fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x41658fd)
#51 0x000000000416f45c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x416f45c)
#52 0x0000000000cb1fb1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb1fb1)
#53 0x0000000000b87ce4 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xb87ce4)
#54 0x00007b6690e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#55 0x00007b6690e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#56 0x0000000000cae6ae _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xcae6ae)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
@EugeneZelenko EugeneZelenko added clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Aug 27, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 27, 2024

@llvm/issue-subscribers-clang-codegen

Author: Herman Narkaytis (hnarkaytis)

x86-64 clang (trunk)
#include &lt;stdarg.h&gt;

void * foo (int size, ...)
{
  va_list va_args;
  __builtin_va_start (va_args, size);
  void * ptr = __builtin_va_arg (va_args, char[size]);
  __builtin_va_end (va_args);
  return (ptr);
}

int main ()
{
  foo (sizeof (0), 0);
  return (0);
}

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-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O1 <source>

  1. <source>:12:1: current parser token 'int'
  2. <source>:3:8: LLVM IR generation of declaration 'foo'
  3. <source>:3:8: Generating code for declaration 'foo'
    #0 0x000000000387c138 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x387c138)
    #1 0x000000000387a2a4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x387a2a4)
    #2 0x00000000037c4988 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
    #3 0x00007b6690e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
    #4 0x0000000003febbe5 clang::CodeGen::CodeGenFunction::EmitAggregateCopy(clang::CodeGen::LValue, clang::CodeGen::LValue, clang::QualType, clang::CodeGen::AggValueSlot::Overlap_t, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3febbe5)
    #5 0x0000000003fec905 (anonymous namespace)::AggExprEmitter::EmitCopy(clang::QualType, clang::CodeGen::AggValueSlot const&, clang::CodeGen::AggValueSlot const&) (.isra.0) CGExprAgg.cpp:0:0
    #6 0x0000000003fed7b5 (anonymous namespace)::AggExprEmitter::EmitFinalDestCopy(clang::QualType, clang::CodeGen::LValue const&, clang::CodeGen::CodeGenFunction::ExprValueKind) CGExprAgg.cpp:0:0
    #7 0x0000000003fee223 clang::CodeGen::CodeGenFunction::EmitAggFinalDestCopy(clang::QualType, clang::CodeGen::AggValueSlot, clang::CodeGen::LValue const&, clang::CodeGen::CodeGenFunction::ExprValueKind) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fee223)
    #8 0x0000000003fcf98f clang::CodeGen::CodeGenFunction::EmitLoadOfAnyValue(clang::CodeGen::LValue, clang::CodeGen::AggValueSlot, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fcf98f)
    #9 0x0000000003d72fb0 (anonymous namespace)::X86_64ABIInfo::EmitVAArg(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType, clang::CodeGen::AggValueSlot) const X86.cpp:0:0
    #10 0x0000000003f3dad0 clang::CodeGen::CodeGenFunction::EmitVAArg(clang::VAArgExpr*, clang::CodeGen::Address&, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f3dad0)
    #11 0x0000000003ff13c8 (anonymous namespace)::AggExprEmitter::Visit(clang::Expr*) CGExprAgg.cpp:0:0
    #12 0x0000000003ff1ed9 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3ff1ed9)
    #13 0x0000000003ff2b7d clang::CodeGen::CodeGenFunction::EmitAggExprToLValue(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3ff2b7d)
    #14 0x0000000003fd5016 clang::CodeGen::CodeGenFunction::EmitLValueHelper(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fd5016)
    #15 0x0000000003fd8925 clang::CodeGen::CodeGenFunction::EmitArrayToPointerDecay(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3fd8925)
    #16 0x000000000403456b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
    #17 0x000000000402caa2 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
    #18 0x000000000402e49b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
    #19 0x0000000004032f5b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
    #20 0x000000000402caa2 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
    #21 0x0000000004031622 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4031622)
    #22 0x0000000003f8aefb clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f8aefb)
    #23 0x0000000003f8c2e3 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f8c2e3)
    #24 0x0000000003f9487b clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f9487b)
    #25 0x0000000003f9a9fc clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
    #26 0x0000000003f9aac8 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3f9aac8)
    #27 0x0000000003bae39f clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bae39f)
    #28 0x0000000003bc2cfa clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bc2cfa)
    #29 0x0000000003bbbb72 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bbbb72)
    #30 0x0000000003bc27a9 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3bc27a9)
    #31 0x0000000003c2a2ba clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c2a2ba)
    #32 0x0000000003c371f8 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c371f8)
    #33 0x0000000003c915bb clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c915bb)
    #34 0x0000000003c8ce25 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c8ce25)
    #35 0x0000000003c8d7b0 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c8d7b0)
    #36 0x0000000003c96e97 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
    #37 0x00000000041580ae (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
    #38 0x0000000004149bc9 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4149bc9)
    #39 0x00000000061048f4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x61048f4)
    #40 0x0000000004155ec5 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x4155ec5)
    #41 0x00000000043fd3b1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x43fd3b1)
    #42 0x000000000437fb8b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x437fb8b)
    #43 0x00000000044e48f3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x44e48f3)
    #44 0x0000000000cb4ccc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb4ccc)
    #45 0x0000000000caec0d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
    #46 0x000000000419f189 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool) const::'lambda'()>(long) Job.cpp:0:0
    #47 0x00000000037c4db3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x37c4db3)
    #48 0x000000000419f3a9 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool) const (.part.0) Job.cpp:0:0
    #49 0x0000000004164f47 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x4164f47)
    #50 0x00000000041658fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x41658fd)
    #51 0x000000000416f45c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x416f45c)
    #52 0x0000000000cb1fb1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb1fb1)
    #53 0x0000000000b87ce4 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xb87ce4)
    #54 0x00007b6690e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
    #55 0x00007b6690e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
    #56 0x0000000000cae6ae _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xcae6ae)
    clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
    Compiler returned: 139

@shafik
Copy link
Collaborator

shafik commented Aug 27, 2024

gcc errors out on this: https://godbolt.org/z/nsj8K448P but ICEs in C mode: https://godbolt.org/z/57doW63We

@hnarkaytis
Copy link
Author

GCC has this issue since 2020 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97986
My bug was closed as duplicate https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116495
Clang was affected since 3.7 - 2015

@AaronBallman AaronBallman added the confirmed Verified by a second party label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

11 participants
@hnarkaytis @AaronBallman @shafik @EugeneZelenko @llvmbot and others