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

    <tr>
        <th>Summary</th>
        <td>
            [clang][bytecode] crash on large multi-dimensional array in new expression
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            crash,
            clang:bytecode
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    Reproducer:
https://godbolt.org/z/G639zMYbv
```cpp
typedef __typeof__ (sizeof 0) size_t;

void* operator new (size_t, void*);
void* operator new[] (size_t, void*);

void *p;

void foo ()
{
    enum { N = 256 };
    p = new char [N][N][N][N][N];
}
```

Backtrace:
```console
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 -fexperimental-new-constant-interpreter <source>
1.      <source>:12:1: current parser token '}'
2.      <source>:9:1: parsing function body 'foo'
3.      <source>:9:1: in compound statement ('{}')
 #0 0x0000000003cdc778 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cdc778)
 #1 0x0000000003cda14c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cda14c)
 #2 0x0000000003c2a4e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000774668242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00000000075e2889 clang::interp::EvalEmitter::emitAllocCN(clang::interp::PrimType, clang::interp::Descriptor const*, bool, clang::interp::SourceInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x75e2889)
 #5 0x000000000790655c clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCXXNewExpr(clang::CXXNewExpr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x790655c)
 #6 0x000000000790c8e9 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCastExpr(clang::CastExpr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x790c8e9)
 #7 0x000000000790a968 clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x790a968)
 #8 0x00000000078ed03f clang::interp::Compiler<clang::interp::EvalEmitter>::visitAssignment(clang::Expr const*, clang::Expr const*, clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x78ed03f)
 #9 0x000000000790d20a clang::interp::Compiler<clang::interp::EvalEmitter>::VisitBinaryOperator(clang::BinaryOperator const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x790d20a)
#10 0x000000000790a968 clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x790a968)
#11 0x00000000079008ca clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x79008ca)
#12 0x00000000075319a3 clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x75319a3)
#13 0x000000000751787e clang::interp::Context::evaluateAsRValue(clang::interp::State&, clang::Expr const*, clang::APValue&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x751787e)
#14 0x00000000074984ea EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) (.part.0) ExprConstant.cpp:0:0
#15 0x000000000749abaf clang::Expr::EvaluateForOverflow(clang::ASTContext const&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x749abaf)
#16 0x000000000650ced6 clang::Sema::CheckForIntOverflow(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x650ced6)
#17 0x000000000653e5b3 clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x653e5b3)
#18 0x00000000068b8409 clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x68b8409)
#19 0x0000000006bd323e clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6bd323e)
#20 0x00000000063c902c clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63c902c)
#21 0x00000000063bfaf6 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63bfaf6)
#22 0x00000000063c04d3 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63c04d3)
#23 0x00000000063c9e7d clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63c9e7d)
#24 0x00000000063ca8ba clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63ca8ba)
#25 0x00000000062a1458 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62a1458)
#26 0x00000000062edc8f clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62edc8f)
#27 0x000000000629a20f clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x629a20f)
#28 0x000000000629b007 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x629b007)
#29 0x00000000062a3c1f clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62a3c1f)
#30 0x00000000062a5470 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62a5470)
#31 0x0000000006293aba clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6293aba)
#32 0x00000000046238cd clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x46238cd)
#33 0x000000000492f13a clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x492f13a)
#34 0x00000000048a86bb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x48a86bb)
#35 0x0000000004a1fd63 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4a1fd63)
#36 0x0000000000dc00c5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xdc00c5)
#37 0x0000000000db806d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#38 0x0000000004695bc9 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
#39 0x0000000003c2a903 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c2a903)
#40 0x0000000004695de9 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
#41 0x000000000465917d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x465917d)
#42 0x000000000465a131 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+++0x465a131)
#43 0x0000000004663f7c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4663f7c)
#44 0x0000000000dbc8d1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xdbc8d1)
#45 0x0000000000c6b864 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc6b864)
#46 0x0000774668229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#47 0x0000774668229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#48 0x0000000000db7b05 _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xdb7b05)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWl1v47a2_TXKC6FAor4f8qA4cW-K6SRIgqL3yaAoyuGNROpSlOP01x-QlC1TsT1pRykOzinajkbkFtdae3NzkybqOrpmhFw50bUT3VygXr5wcfXqIiH4W3dR8PL96pG0gpc9JsIJcsfLX6RsO_UIlw5crnlZ8FpecrF24PJPBy5_iYPsz9_-t9g4Xu7EnvkXt63j5fK9JSWpwGqlnni1WgEHph39k_AKeA7MgHpeSSe4VsZevuG0dGAOeEsEklwARt52JivpwAUYejgwM0bHLAy783aDKXBg3tpvKs6Vqerp5U6imgAAgLC-AU5yDb4DJ7gBMIqBk9wYU9Xe6tcKL35BAjjR9Xcnujn7hxk2uTkUzgC5RvhVCoSJccEoK2cdr4nj5Q_fbvOnW9D1RUMlQKDo10CQlgsJJAcTn1H50heXmDcOXNb1ZveH2wr-fwRLBy5p1_Wkc-ASIFYCynDdlwTIFwKwQN0LKPaA4AK0QoUIJl1HStDxXpjXyhJ1HccUSVIC0TPQYUFbeel4-ZNE-BWUfdMaSt6l42UPgq8FagAS674hTCrIwIFL3ipMmDctrYlwybatuSBCvasRW7tS9OzVgcuCst07B1478Bq46_INicoNgbsGrnLkErWt-mQv215edsBtFHXguts0dlHXuN07k2jrBDeUSVIDt2Lc3RBR8I6oduA-AdddY-xKzmv8gihzgpuzIFXnjqG2e-ESuBXmNRduSdGa8U5S3JkxtLCT12TbEkGVFKh2GXlzlcMlYtJV4EQriCQCOMFiUD24dbzcV1Ja74Lch-p_Sk7cC0GYBC0SHRFA8lfCgAMTFXcwcbwcHjHPdtbKirI1qHqGJeUMqBShzCvOjXlwzpwyoATiPStBJ5EkipqZXYmaWgaDnmnAgYEHvK23-yfAJU6SFOiADXInyLv3zjw8CMqkjqhnE5Pp2EmgtxXvpCCocWCs4pIyqVKNHvXvh5YDr73tgGlE7E8QIz_ExxAva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