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

    <tr>
        <th>Summary</th>
        <td>
            clang 18.1.3 crashes when building intel-media-driver 24.2.0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    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](https://github.com/llvm/llvm-project/files/15000072/mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.cpp.txt)
[mhw_vdbox_hcp_hwcmd_g11_X-59d4c7.sh.txt](https://github.com/llvm/llvm-project/files/15000073/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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW01z4zaT_jX0BQUVCZIidfBB_tBktmYqk7ErSe1FBQJNCjEJcAFQI-fXbwGkLUH2fMir7GbzvimVI4Fg9_N0N7qbIIYaIxoJcBnlV1F-c0EHu1H6UsKD6s3jgzJwUSn-ePlF2A0yqgO7EbJBW9CPqFWyQa14ALSxtjdRuozIKiIr0TUz-kgf6YzDNiKrd4n-z_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