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

clang 18.1.3 crashes when building intel-media-driver 24.2.0 #88931

Closed
nekopsykose opened this issue Apr 16, 2024 · 11 comments · Fixed by #89126
Closed

clang 18.1.3 crashes when building intel-media-driver 24.2.0 #88931

nekopsykose opened this issue Apr 16, 2024 · 11 comments · Fixed by #89126
Assignees
Labels
clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] release:backport

Comments

@nekopsykose
Copy link

with something very long like https://img.ayaya.dev/G1rZTjcJRL7v

run script + pp source (remove .txt extensions):
mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.cpp.txt
mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.sh.txt

an attempted minimisation with cvise:

$ cat /tmp/repro.ii                                                                     
struct mhw_vdbox_hcp_g9_glk {
  struct HCP_FQM_STATE_CMD {
    int Quantizermatrix[];
    HCP_FQM_STATE_CMD();
  };
};
void memset(void *__attribute__((pass_dynamic_object_size(0))));
mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD() {
  memset(Quantizermatrix);
}
$ clang++ /tmp/repro.ii
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: /usr/bin/clang-18 -cc1 -triple x86_64-chimera-linux-musl -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name repro.ii -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/demon/src/cports -fcoverage-compilation-dir=/home/demon/src/cports -resource-dir /usr/lib/clang/18 -fdeprecated-macro -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/repro-c9f84f.o -x c++-cpp-output /tmp/repro.ii
1.	<eof> parser at end of file
2.	/tmp/repro.ii:8:42: LLVM IR generation of declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
3.	/tmp/repro.ii:8:42: Generating code for declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
4.	/tmp/repro.ii:8:62: LLVM IR generation of compound statement ('{}')
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 18.1.3
Target: x86_64-chimera-linux-musl
Thread model: posix
InstalledDir: /usr/bin
clang++: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

also on debian, has a nice stacktrace:

cq14# clang++-18 /tmp/repro.ii 
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: /usr/lib/llvm-18/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name repro.ii -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 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root -fcoverage-compilation-dir=/root -resource-dir /usr/lib/llvm-18/lib/clang/18 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/repro-8c15f6.o -x c++-cpp-output /tmp/repro.ii
1.	<eof> parser at end of file
2.	/tmp/repro.ii:8:42: LLVM IR generation of declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
3.	/tmp/repro.ii:8:42: Generating code for declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
4.	/tmp/repro.ii:8:62: LLVM IR generation of compound statement ('{}')
 #0 0x00007fffed5a924a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xda924a)
 #1 0x00007fffed5a7274 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xda7274)
 #2 0x00007fffed5a990b (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xda990b)
 #3 0x00007fffec25a510 (/lib/x86_64-linux-gnu/libc.so.6+0x3c510)
 #4 0x00007ffff5c19255 clang::CodeGen::CodeGenFunction::FindFlexibleArrayMemberField(clang::ASTContext&, clang::RecordDecl const*, llvm::StringRef, unsigned long&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c19255)
 #5 0x00007ffff5c195eb clang::CodeGen::CodeGenFunction::emitFlexibleArrayMemberSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c195eb)
 #6 0x00007ffff5c18d73 clang::CodeGen::CodeGenFunction::emitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c18d73)
 #7 0x00007ffff5c18bcd clang::CodeGen::CodeGenFunction::evaluateOrEmitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c18bcd)
 #8 0x00007ffff5d2ba31 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) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1d2ba31)
 #9 0x00007ffff5de85e9 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1de85e9)
#10 0x00007ffff5de775b clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1de775b)
#11 0x00007ffff5e2dff9 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1e2dff9)
#12 0x00007ffff5e1cfa1 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1e1cfa1)
#13 0x00007ffff5dca55d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1dca55d)
#14 0x00007ffff5f24cc0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f24cc0)
#15 0x00007ffff5f25541 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f25541)
#16 0x00007ffff5f24be1 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f24be1)
#17 0x00007ffff5d3ab42 clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1d3ab42)
#18 0x00007ffff5f8aa0f clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f8aa0f)
#19 0x00007ffff5d17950 clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1d17950)
#20 0x00007ffff60298fe (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x20298fe)
#21 0x00007ffff5fa5718 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1fa5718)
#22 0x00007ffff5fa9563 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1fa9563)
#23 0x00007ffff6024fc9 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x2024fc9)
#24 0x00007ffff60448dc (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x20448dc)
#25 0x00007ffff5f7ac12 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f7ac12)
#26 0x00007ffff4b8b0ba clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0xb8b0ba)
#27 0x00007ffff69ebb89 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x29ebb89)
#28 0x00007ffff69634e4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x29634e4)
#29 0x00007ffff6a6751e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x2a6751e)
#30 0x0000555555567576 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x13576)
#31 0x0000555555564825 (/usr/lib/llvm-18/bin/clang+0x10825)
#32 0x00005555555639d8 clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-18/bin/clang+0xf9d8)
#33 0x000055555557179a main (/usr/lib/llvm-18/bin/clang+0x1d79a)
#34 0x00007fffec2456ca (/lib/x86_64-linux-gnu/libc.so.6+0x276ca)
#35 0x00007fffec245785 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x27785)
#36 0x0000555555561181 _start (/usr/lib/llvm-18/bin/clang+0xd181)
clang++-18: error: unable to execute command: Segmentation fault (core dumped)
clang++-18: error: clang frontend command failed due to signal (use -v to see invocation)
Debian clang version 18.1.3 (1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++-18: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

clang 17 works fine

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Apr 16, 2024
@EugeneZelenko EugeneZelenko added clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Apr 16, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 16, 2024

@llvm/issue-subscribers-clang-codegen

Author: alice (nekopsykose)

with something very long like https://img.ayaya.dev/G1rZTjcJRL7v

run script + pp source (remove .txt extensions):
mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.cpp.txt
mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.sh.txt

an attempted minimisation with cvise:

$ cat /tmp/repro.ii                                                                     
struct mhw_vdbox_hcp_g9_glk {
  struct HCP_FQM_STATE_CMD {
    int Quantizermatrix[];
    HCP_FQM_STATE_CMD();
  };
};
void memset(void *__attribute__((pass_dynamic_object_size(0))));
mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD() {
  memset(Quantizermatrix);
}
$ clang++ /tmp/repro.ii
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: /usr/bin/clang-18 -cc1 -triple x86_64-chimera-linux-musl -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name repro.ii -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/demon/src/cports -fcoverage-compilation-dir=/home/demon/src/cports -resource-dir /usr/lib/clang/18 -fdeprecated-macro -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/repro-c9f84f.o -x c++-cpp-output /tmp/repro.ii
1.	&lt;eof&gt; parser at end of file
2.	/tmp/repro.ii:8:42: LLVM IR generation of declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
3.	/tmp/repro.ii:8:42: Generating code for declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
4.	/tmp/repro.ii:8:62: LLVM IR generation of compound statement ('{}')
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 18.1.3
Target: x86_64-chimera-linux-musl
Thread model: posix
InstalledDir: /usr/bin
clang++: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

also on debian, has a nice stacktrace:

cq14# clang++-18 /tmp/repro.ii 
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: /usr/lib/llvm-18/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name repro.ii -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 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root -fcoverage-compilation-dir=/root -resource-dir /usr/lib/llvm-18/lib/clang/18 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/repro-8c15f6.o -x c++-cpp-output /tmp/repro.ii
1.	&lt;eof&gt; parser at end of file
2.	/tmp/repro.ii:8:42: LLVM IR generation of declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
3.	/tmp/repro.ii:8:42: Generating code for declaration 'mhw_vdbox_hcp_g9_glk::HCP_FQM_STATE_CMD::HCP_FQM_STATE_CMD'
4.	/tmp/repro.ii:8:62: LLVM IR generation of compound statement ('{}')
 #<!-- -->0 0x00007fffed5a924a llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xda924a)
 #<!-- -->1 0x00007fffed5a7274 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xda7274)
 #<!-- -->2 0x00007fffed5a990b (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xda990b)
 #<!-- -->3 0x00007fffec25a510 (/lib/x86_64-linux-gnu/libc.so.6+0x3c510)
 #<!-- -->4 0x00007ffff5c19255 clang::CodeGen::CodeGenFunction::FindFlexibleArrayMemberField(clang::ASTContext&amp;, clang::RecordDecl const*, llvm::StringRef, unsigned long&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c19255)
 #<!-- -->5 0x00007ffff5c195eb clang::CodeGen::CodeGenFunction::emitFlexibleArrayMemberSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c195eb)
 #<!-- -->6 0x00007ffff5c18d73 clang::CodeGen::CodeGenFunction::emitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c18d73)
 #<!-- -->7 0x00007ffff5c18bcd clang::CodeGen::CodeGenFunction::evaluateOrEmitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1c18bcd)
 #<!-- -->8 0x00007ffff5d2ba31 clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&amp;, clang::CodeGen::CodeGenFunction::PrototypeWrapper, llvm::iterator_range&lt;clang::Stmt::CastIterator&lt;clang::Expr, clang::Expr const* const, clang::Stmt const* const&gt;&gt;, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1d2ba31)
 #<!-- -->9 0x00007ffff5de85e9 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&amp;, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1de85e9)
#<!-- -->10 0x00007ffff5de775b clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1de775b)
#<!-- -->11 0x00007ffff5e2dff9 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1e2dff9)
#<!-- -->12 0x00007ffff5e1cfa1 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1e1cfa1)
#<!-- -->13 0x00007ffff5dca55d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1dca55d)
#<!-- -->14 0x00007ffff5f24cc0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef&lt;clang::Attr const*&gt;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f24cc0)
#<!-- -->15 0x00007ffff5f25541 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef&lt;clang::Attr const*&gt;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f25541)
#<!-- -->16 0x00007ffff5f24be1 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef&lt;clang::Attr const*&gt;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f24be1)
#<!-- -->17 0x00007ffff5d3ab42 clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1d3ab42)
#<!-- -->18 0x00007ffff5f8aa0f clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f8aa0f)
#<!-- -->19 0x00007ffff5d17950 clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1d17950)
#<!-- -->20 0x00007ffff60298fe (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x20298fe)
#<!-- -->21 0x00007ffff5fa5718 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1fa5718)
#<!-- -->22 0x00007ffff5fa9563 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1fa9563)
#<!-- -->23 0x00007ffff6024fc9 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x2024fc9)
#<!-- -->24 0x00007ffff60448dc (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x20448dc)
#<!-- -->25 0x00007ffff5f7ac12 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x1f7ac12)
#<!-- -->26 0x00007ffff4b8b0ba clang::ParseAST(clang::Sema&amp;, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0xb8b0ba)
#<!-- -->27 0x00007ffff69ebb89 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x29ebb89)
#<!-- -->28 0x00007ffff69634e4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x29634e4)
#<!-- -->29 0x00007ffff6a6751e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18.1+0x2a6751e)
#<!-- -->30 0x0000555555567576 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x13576)
#<!-- -->31 0x0000555555564825 (/usr/lib/llvm-18/bin/clang+0x10825)
#<!-- -->32 0x00005555555639d8 clang_main(int, char**, llvm::ToolContext const&amp;) (/usr/lib/llvm-18/bin/clang+0xf9d8)
#<!-- -->33 0x000055555557179a main (/usr/lib/llvm-18/bin/clang+0x1d79a)
#<!-- -->34 0x00007fffec2456ca (/lib/x86_64-linux-gnu/libc.so.6+0x276ca)
#<!-- -->35 0x00007fffec245785 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x27785)
#<!-- -->36 0x0000555555561181 _start (/usr/lib/llvm-18/bin/clang+0xd181)
clang++-18: error: unable to execute command: Segmentation fault (core dumped)
clang++-18: error: clang frontend command failed due to signal (use -v to see invocation)
Debian clang version 18.1.3 (1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++-18: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

clang 17 works fine

@DimitryAndric
Copy link
Collaborator

This regressed with llvmorg-18-init-17371-g00b6d03 ("[Clang] Implement the 'counted_by' attribute (#76348)") by @bwendling, CC @nickdesaulniers @kees @rapidsna .

@DimitryAndric
Copy link
Collaborator

Note that it is an assertion:

Assertion failed: (Begin + idx < End), function operator[], file /home/dim/src/llvm/llvm-project/clang/include/clang/AST/ASTVector.h, line 116.
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: /home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang -cc1 -triple x86_64-chimera-linux-musl -emit-llvm-bc -flto=thin -flto-unit -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mhw_vdbox_hcp_hwcmd_g11_X.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -relaxed-aliasing -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/builddir/intel-media-driver-24.2.0/build -fdebug-prefix-map=/builddir/intel-media-driver-24.2.0=. -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/builddir/intel-media-driver-24.2.0/build -sys-header-deps -D CLASS_TRACE=0 -D ENABLE_KERNELS -D HEVC_FEI_ENABLE_CMRT -D IGFX_ARL_SUPPORTED -D IGFX_DG2_SUPPORTED -D IGFX_GEN11_ICLLP_SUPPORTED -D IGFX_GEN11_JSL_SUPPORTED -D IGFX_GEN11_SUPPORTED -D IGFX_GEN12_ADLN_SUPPORTED -D IGFX_GEN12_ADLP_SUPPORTED -D IGFX_GEN12_ADLS_SUPPORTED -D IGFX_GEN12_DG1_SUPPORTED -D IGFX_GEN12_RKL_SUPPORTED -D IGFX_GEN12_SUPPORTED -D IGFX_GEN12_TGLLP_CMFCPATCH_SUPPORTED -D IGFX_GEN12_TGLLP_CMFC_SUPPORTED -D IGFX_GEN12_TGLLP_SUPPORTED -D IGFX_GEN12_TGLLP_SWSB_SUPPORTED -D IGFX_GEN8_BDW_SUPPORTED -D IGFX_GEN8_SUPPORTED -D IGFX_GEN9_BXT_SUPPORTED -D IGFX_GEN9_CFL_SUPPORTED -D IGFX_GEN9_CML_SUPPORTED -D IGFX_GEN9_CMPV_SUPPORTED -D IGFX_GEN9_GLK_SUPPORTED -D IGFX_GEN9_KBL_SUPPORTED -D IGFX_GEN9_SKL_SUPPORTED -D IGFX_GEN9_SUPPORTED -D IGFX_MTL_SUPPORTED -D IGFX_XEHP_SDV_CMFCPATCH_SUPPORTED -D IGFX_XEHP_SDV_SUPPORTED -D IGFX_XE_HPG_CMFCPATCH_SUPPORTED -D IGFX_XE_HPG_SUPPORTED -D MEDIA_VERSION=\"24.2.0\" -D MEDIA_VERSION_DETAILS=\"\" -D VEBOX_AUTO_DENOISE_SUPPORTED=1 -D X11_FOUND -D _AV1_DECODE_SUPPORTED -D _AV1_ENCODE_VDENC_SUPPORTED -D _AVC_DECODE_SUPPORTED -D _AVC_ENCODE_VDENC_SUPPORTED -D _AVC_ENCODE_VME_SUPPORTED -D _COMMON_ENCODE_SUPPORTED -D _DECODE_PROCESSING_SUPPORTED -D _HEVC_DECODE_SUPPORTED -D _HEVC_ENCODE_VDENC_SUPPORTED -D _HEVC_ENCODE_VME_SUPPORTED -D _JPEG_DECODE_SUPPORTED -D _JPEG_ENCODE_SUPPORTED -D _MANUAL_SOFTLET_ -D _MMC_SUPPORTED -D _MPEG2_DECODE_SUPPORTED -D _MPEG2_ENCODE_VME_SUPPORTED -D _RELEASE -D _VC1_DECODE_SUPPORTED -D _VP8_DECODE_SUPPORTED -D _VP8_ENCODE_SUPPORTED -D _VP9_DECODE_SUPPORTED -D _VP9_ENCODE_VDENC_SUPPORTED -D __STDC_CONSTANT_MACROS -D __STDC_LIMIT_MACROS -D __VPHAL_SFC_SUPPORTED=1 -D NDEBUG -D LINUX=1 -D LINUX -D NO_RTTI -D NO_EXCEPTION_HANDLING -D INTEL_NOT_PUBLIC -D _AMD64_ -D __CT__ -D __linux__ -fmacro-prefix-map=/builddir/intel-media-driver-24.2.0=. -fcoverage-prefix-map=/builddir/intel-media-driver-24.2.0=. -O2 -Wformat -Werror=format-security -Wreorder -Wsign-promo -Wnon-virtual-dtor -Wno-invalid-offsetof -Wall -Winit-self -Wpointer-arith -Wno-unused -Wno-unknown-pragmas -Wno-comments -Wno-sign-compare -Wno-attributes -Wno-narrowing -Wno-overflow -Wno-parentheses -Wno-delete-incomplete -Werror=address -Werror=format-security -Werror=non-virtual-dtor -Werror=return-type -Wno-deprecated -Wno-missing-braces -Wno-overloaded-virtual -Wbitfield-constant-conversion -Wno-extern-c-compat -Wno-inconsistent-missing-override -Wno-ignored-optimization-argument -std=c++14 -ferror-limit 19 -fvisibility=hidden -fvisibility-inlines-hidden -fsanitize=integer-divide-by-zero,signed-integer-overflow -fsanitize-trap=integer-divide-by-zero,signed-integer-overflow -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=zero -fno-use-cxa-atexit -fgnuc-version=4.2.1 -finline-functions -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.cpp
1.      /builddir/intel-media-driver-24.2.0/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_hwcmd_g11_X.cpp:165:1: current parser token 'mhw_vdbox_hcp_g11_X'
2.      /builddir/intel-media-driver-24.2.0/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_hwcmd_g11_X.cpp:147:40: LLVM IR generation of declaration 'mhw_vdbox_hcp_g11_X::HCP_QM_STATE_CMD::HCP_QM_STATE_CMD'
3.      /builddir/intel-media-driver-24.2.0/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_hwcmd_g11_X.cpp:147:40: Generating code for declaration 'mhw_vdbox_hcp_g11_X::HCP_QM_STATE_CMD::HCP_QM_STATE_CMD'
4.      /builddir/intel-media-driver-24.2.0/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_hwcmd_g11_X.cpp:148:1: LLVM IR generation of compound statement ('{}')
 #0 0x0000000003ff98f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x3ff98f8)
 #1 0x0000000003ff76b9 llvm::sys::RunSignalHandlers() (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x3ff76b9)
 #2 0x0000000003ffa0be SignalHandler(int) Signals.cpp:0:0
 #3 0x0000000828d8c4af handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
 #4 0x0000000828d8ba6b thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:245:1
 #5 0x00000008280692d3 ([vdso]+0x2d3)
 #6 0x000000082fe48a0a __sys_thr_kill /usr/obj/usr/src/lib/libc/thr_kill.S:4:0
 #7 0x000000082fdc21e4 _raise /usr/src/lib/libc/gen/raise.c:0:10
 #8 0x000000082fe72bc9 abort /usr/src/lib/libc/stdlib/abort.c:71:17
 #9 0x000000082fda5551 (/lib/libc.so.7+0x93551)
#10 0x0000000004594a0f (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4594a0f)
#11 0x0000000004594c5b clang::CodeGen::CodeGenFunction::emitFlexibleArrayMemberSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4594c5b)
#12 0x00000000045942cf clang::CodeGen::CodeGenFunction::emitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x45942cf)
#13 0x00000000045940f1 clang::CodeGen::CodeGenFunction::evaluateOrEmitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*, llvm::Value*, bool) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x45940f1)
#14 0x000000000426d17d 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) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x426d17d)
#15 0x0000000004344d57 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4344d57)
#16 0x0000000004343b7e clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4343b7e)
#17 0x000000000435b3c7 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#18 0x00000000043485fb clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x43485fb)
#19 0x0000000004321c5b clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4321c5b)
#20 0x0000000004321bd8 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4321bd8)
#21 0x00000000043fc515 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x43fc515)
#22 0x00000000043fcf51 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x43fcf51)
#23 0x00000000043fc42e clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x43fc42e)
#24 0x000000000448210c clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x448210c)
#25 0x000000000430fa6b clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x430fa6b)
#26 0x00000000044f8059 clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x44f8059)
#27 0x000000000424ce54 (anonymous namespace)::ItaniumCXXABI::emitCXXStructor(clang::GlobalDecl) ItaniumCXXABI.cpp:0:0
#28 0x00000000041f1f8f clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x41f1f8f)
#29 0x00000000041f6ad6 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x41f6ad6)
#30 0x0000000004247cc4 (anonymous namespace)::ItaniumCXXABI::EmitCXXConstructors(clang::CXXConstructorDecl const*) ItaniumCXXABI.cpp:0:0
#31 0x000000000479096c (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#32 0x0000000004786d45 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4786d45)
#33 0x0000000005a864e9 clang::ParseAST(clang::Sema&, bool, bool) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x5a864e9)
#34 0x0000000004b3d823 clang::FrontendAction::Execute() (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4b3d823)
#35 0x0000000004ac4a1d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4ac4a1d)
#36 0x0000000004c1426e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x4c1426e)
#37 0x00000000024dccd0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x24dccd0)
#38 0x00000000024d9e95 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x00000000024d8ef7 clang_main(int, char**, llvm::ToolContext const&) (/home/dim/ins/llvmorg-18-init-17371-g00b6d032a22/bin/clang+0x24d8ef7)
Abort trap

so I assume this is some array or vector that is shrunk while references are still pointing to it?

@bwendling bwendling self-assigned this Apr 17, 2024
bwendling added a commit that referenced this issue Apr 19, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: #88931
@bwendling
Copy link
Collaborator

/cherry-pick c32712d

@bwendling bwendling reopened this Apr 19, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 19, 2024

/cherry-pick c32712d

Error: Command failed due to missing milestone.

@bwendling
Copy link
Collaborator

/cherry-pick c32712d 18.1.5

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 19, 2024

/cherry-pick c32712d 18.1.5

Error: Command failed due to missing milestone.

@nickdesaulniers
Copy link
Member

@bwendling the bot is trying to warn you that you need to set a milestone. To do so, in the GitHub UI on this page click the gear icon next to "Milestone" (Ctrl+f) then select the 18 release. cc @tru . Sorry if you already pushed to the release/18.x branch.

@bwendling
Copy link
Collaborator

Ah! I wasn't aware...

@bwendling
Copy link
Collaborator

/cherry-pick c32712d

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Apr 19, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: llvm#88931
(cherry picked from commit c32712d)
@llvmbot llvmbot closed this as completed Apr 19, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 19, 2024

/pull-request #89456

aniplcc pushed a commit to aniplcc/llvm-project that referenced this issue Apr 21, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: llvm#88931
bwendling added a commit that referenced this issue Apr 25, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: #88931
tstellar pushed a commit that referenced this issue Apr 29, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: #88931
ahatanaka pushed a commit to swiftlang/llvm-project that referenced this issue Jun 25, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: llvm#88931
(cherry picked from commit c32712d)
ahatanaka pushed a commit to swiftlang/llvm-project that referenced this issue Jun 25, 2024
A struct that declares an inner struct, but no fields, won't have a
field count. So getting the offset of the inner struct fails. This
happens in both C and C++:

  struct foo {
    struct bar {
      int Quantizermatrix[];
    };
  };

Here 'struct foo' has no fields.

Closes: llvm#88931
(cherry picked from commit c32712d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] release:backport
Projects
Development

Successfully merging a pull request may close this issue.

6 participants