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

    <tr>
        <th>Summary</th>
        <td>
            [clang][bytecode] assertion failure on static_assert with empty-initialized array element access
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            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/bbcM899jh
```cpp
void foo() {
    const char s[] = {};
    static_assert(s[0] == '0');
}
```

Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ByteCode/Pointer.h:689: T& clang::interp::Pointer::deref() const [with T = clang::interp::Integral<8, true>]: Assertion `Offset + sizeof(T) <= asBlockPointer().Pointee->getDescriptor()->getAllocSize()' failed.
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-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 -x c -fexperimental-new-constant-interpreter -std=c23 <source>
1.      <source>:4:1: current parser token '}'
2.      <source>:1:12: parsing function body 'foo'
3.      <source>:1:12: in compound statement ('{}')
 #0 0x000000000402e688 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x402e688)
 #1 0x000000000402bab4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x402bab4)
 #2 0x0000000003f702e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000077a603842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000077a6038969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000077a603842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000077a6038287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000077a60382871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000077a603839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000007a0c6c9 clang::interp::Integral<8u, true>& clang::interp::Pointer::deref<clang::interp::Integral<8u, true>>() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7a0c6c9)
#10 0x0000000007bda261 clang::interp::Pointer::toRValue(clang::interp::Context const&, clang::QualType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7bda261)
#11 0x0000000007a006c6 bool clang::interp::EvalEmitter::emitRet<(clang::interp::PrimType)13>(clang::interp::SourceInfo const&) (.part.0) EvalEmitter.cpp:0:0
#12 0x0000000007a56f48 clang::interp::EvalEmitter::emitRet(clang::interp::PrimType, clang::interp::SourceInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7a56f48)
#13 0x0000000007e55b41 clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e55b41)
#14 0x00000000079f4c71 clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x79f4c71)
#15 0x00000000079cc4b2 clang::interp::Context::evaluateAsRValue(clang::interp::State&, clang::Expr const*, clang::APValue&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x79cc4b2)
#16 0x00000000079452e3 EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#17 0x0000000007949e58 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&, clang::ASTContext const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7949e58)
#18 0x000000000693b1db TryGetExprRange(clang::ASTContext&, clang::Expr const*, unsigned int, bool, bool) SemaChecking.cpp:0:0
#19 0x000000000694f3a2 CheckTautologicalComparison(clang::Sema&, clang::BinaryOperator*, clang::Expr*, clang::Expr*, llvm::APSInt const&, bool) SemaChecking.cpp:0:0
#20 0x00000000069715e1 AnalyzeImplicitConversions(clang::Sema&, clang::Expr*, clang::SourceLocation, bool) (.constprop.0) SemaChecking.cpp:0:0
#21 0x00000000069721a5 clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69721a5)
#22 0x0000000006cf2467 clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cf2467)
#23 0x0000000006b4806e clang::Sema::BuildStaticAssertDeclaration(clang::SourceLocation, clang::Expr*, clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b4806e)
#24 0x0000000006746266 clang::Parser::ParseStaticAssertDeclaration(clang::SourceLocation&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6746266)
#25 0x0000000006734656 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6734656)
#26 0x00000000067f5df2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67f5df2)
#27 0x00000000067f6ac9 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67f6ac9)
#28 0x00000000067fec1b clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67fec1b)
#29 0x00000000067ff42a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67ff42a)
#30 0x00000000066f594b clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f594b)
#31 0x000000000672bd9d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672bd9d)
#32 0x00000000066e871e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e871e)
#33 0x00000000066e8ebf clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e8ebf)
#34 0x00000000066f0cfa clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f0cfa)
#35 0x00000000066f1c95 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f1c95)
#36 0x00000000066f2150 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f2150)
#37 0x00000000066e37e3 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e37e3)
#38 0x00000000049d0db8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49d0db8)
#39 0x0000000004cc5965 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cc5965)
#40 0x0000000004c41b0e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c41b0e)
#41 0x0000000004db7411 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4db7411)
#42 0x0000000000db194f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdb194f)
#43 0x0000000000da85fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#44 0x0000000004a38d89 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
#45 0x0000000003f70784 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f70784)
#46 0x0000000004a3939f 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
#47 0x00000000049fb05d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49fb05d)
#48 0x00000000049fc0ee 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+++0x49fc0ee)
#49 0x0000000004a03d25 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a03d25)
#50 0x0000000000dade05 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdade05)
#51 0x0000000000c61934 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc61934)
#52 0x000077a603829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#53 0x000077a603829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#54 0x0000000000da80a5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda80a5)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkW11z4ygW_TXKCyWXhL4f8qA48WymeqqzcWpeUwghmwkGLaB00r9-C5AtS7HdSU_cu7U71VMVS3A559zL5QohpBRdcUIuveTKS64vUKfXQl4--UhK8U1dVKJ-vbwnrRR1h4n0otILyrXWrTJ_woUHFytRV4LpmZArDy6-e3BRVfiPvCj-WntB6aWB-4fb1gvKZ0Fr0AjhwdyDBfCyKy8oAQAAC640wGskgXJYgBdd2wbZtRdtmymNNMWPSCkitQdz0zboG9v2MAs8mHmwcH1M5z0Q5u-gvEL4SUuEiaMzQBRcCUa8oMQM8ZUHr8y_qAQeXEghtAcXjD1v_FaKvwje_vTgQgvBlAcXfbcFo5UHF-XywYOLq1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