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

    <tr>
        <th>Summary</th>
        <td>
            clang crashes if `#embed` is not alone in initializer list for multidimensional array
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c23,
            clang:codegen,
            embed
      </td>
    </tr>

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

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

<pre>
    As weird as it sounds the following is fine
```
const char SelfBytes[3][3] = {
    #embed __FILE__ limit(2)
};
```
but this crashes
```
const char SelfBytes[3][3] = {
    10, 2,
    #embed __FILE__ limit(2)
};
```
with the following stacktrace
```
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-assertions-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 -emit-llvm <source>
1.      <eof> parser at end of file
2.      <source>:1:12: LLVM IR generation of declaration 'SelfBytes'
3.      <source>:1:12: Generating code for declaration 'SelfBytes'
 #0 0x0000000003e62338 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e62338)
 #1 0x0000000003e5fff4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e5fff4)
 #2 0x0000000003dac928 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007e07a3c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00000000042069b4 (anonymous namespace)::EmitArrayConstant(clang::CodeGen::CodeGenModule&, llvm::ArrayType*, llvm::Type*, unsigned long, llvm::SmallVectorImpl<llvm::Constant*>&, llvm::Constant*) CGExprConstant.cpp:0:0
 #5 0x00000000042145c5 (anonymous namespace)::ConstExprEmitter::EmitArrayInitialization(clang::InitListExpr const*, clang::QualType) (.isra.0) CGExprConstant.cpp:0:0
 #6 0x0000000004215018 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::ConstExprEmitter, llvm::Constant*, clang::QualType>::Visit(clang::Stmt const*, clang::QualType) CGExprConstant.cpp:0:0
 #7 0x00000000042157b4 clang::CodeGen::ConstantEmitter::tryEmitPrivate(clang::Expr const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42157b4)
 #8 0x0000000004215956 clang::CodeGen::ConstantEmitter::tryEmitPrivateForMemory(clang::Expr const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4215956)
 #9 0x00000000042144b8 (anonymous namespace)::ConstExprEmitter::EmitArrayInitialization(clang::InitListExpr const*, clang::QualType) (.isra.0) CGExprConstant.cpp:0:0
#10 0x0000000004215018 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::ConstExprEmitter, llvm::Constant*, clang::QualType>::Visit(clang::Stmt const*, clang::QualType) CGExprConstant.cpp:0:0
#11 0x0000000004217333 clang::CodeGen::ConstantEmitter::tryEmitPrivateForVarInit(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4217333)
#12 0x0000000004217592 clang::CodeGen::ConstantEmitter::tryEmitForInitializer(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4217592)
#13 0x00000000043fb06e clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43fb06e)
#14 0x000000000441f951 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x441f951)
#15 0x000000000441fdcb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x441fdcb)
#16 0x000000000442a04b clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#17 0x0000000004827eb6 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#18 0x0000000004817b44 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4817b44)
#19 0x0000000006415fe4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6415fe4)
#20 0x0000000004824728 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4824728)
#21 0x0000000004aec505 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4aec505)
#22 0x0000000004a6fcde clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4a6fcde)
#23 0x0000000004bdad8e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4bdad8e)
#24 0x0000000000d4f5cf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd4f5cf)
#25 0x0000000000d46eea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x000000000486c659 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
#27 0x0000000003dacdd4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3dacdd4)
#28 0x000000000486cc4f 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
#29 0x000000000482f86d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x482f86d)
#30 0x00000000048308ee clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48308ee)
#31 0x0000000004838885 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4838885)
#32 0x0000000000d4c3c3 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd4c3c3)
#33 0x0000000000c13ae4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc13ae4)
#34 0x00007e07a3c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x00007e07a3c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x0000000000d46995 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd46995)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```

https://godbolt.org/z/5117rnrxf
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWl1z26rW_jXkhpEHoQ9LF75wnLhv92TP29N0eutBgBxOEWgApU5__RmQHFmqkzat955z5pxOM4n4WDzPw4K1hCDWir3ifAWya4Dx9psizTelFcAYZDdXpHMP2qyei68qzZ5Wawu_cmEYJBYKB63uF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