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

    <tr>
        <th>Summary</th>
        <td>
            [clang][bytecode] Assertion `!isUnknownSizeArray() && "Array of unknown size"' failed.
        </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/j89r1n4G4
```cpp
#include <cstddef>
#include <cstdlib>
#include <cstring>

extern const char s[];

void foo(char *x)
{
    char *r = static_cast<char*>(std::malloc(std::strlen(x)));
    std::strcpy(r, s);
}
```

Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ByteCode/Descriptor.h:232: unsigned int clang::interp::Descriptor::getSize() const: Assertion `!isUnknownSizeArray() && "Array of unknown size"' 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 -fexperimental-new-constant-interpreter <source>
1.      <source>:10:21: current parser token ')'
2.      <source>:8:1: parsing function body 'foo'
3.      <source>:8:1: in compound statement ('{}')
 #0 0x0000000004026d28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4026d28)
 #1 0x0000000004024154 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4024154)
 #2 0x0000000003f68988 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000070dcf8e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000070dcf8e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000070dcf8e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000070dcf8e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000070dcf8e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000070dcf8e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000079b72ac bool llvm::function_ref<bool (clang::interp::Pointer const&)>::callback_fn<clang::interp::Context::evaluateStrlen(clang::interp::State&, clang::Expr const*, unsigned long&)::'lambda'(clang::interp::Pointer const&)>(long, clang::interp::Pointer const&) Context.cpp:0:0
#10 0x00000000079d0c6e bool clang::interp::EvalEmitter::emitRet<(clang::interp::PrimType)13>(clang::interp::SourceInfo const&) (.part.0) EvalEmitter.cpp:0:0
#11 0x00000000079fef70 clang::interp::EvalEmitter::emitRet(clang::interp::PrimType, clang::interp::SourceInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x79fef70)
#12 0x0000000007e30020 clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e30020)
#13 0x00000000079c59d9 clang::interp::EvalEmitter::interpretAsPointer(clang::Expr const*, llvm::function_ref<bool (clang::interp::Pointer const&)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x79c59d9)
#14 0x00000000079b9c24 clang::interp::Context::evaluateStrlen(clang::interp::State&, clang::Expr const*, unsigned long&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x79b9c24)
#15 0x000000000794a182 clang::Expr::tryEvaluateStrLen(unsigned long&, clang::ASTContext&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x794a182)
#16 0x000000000691accf clang::Sema::checkFortifiedBuiltinMemoryFunction(clang::FunctionDecl*, clang::CallExpr*)::'lambda2'(unsigned int)::operator()(unsigned int) const (.constprop.0) SemaChecking.cpp:0:0
#17 0x000000000693059a clang::Sema::checkFortifiedBuiltinMemoryFunction(clang::FunctionDecl*, clang::CallExpr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x693059a)
#18 0x0000000006c3d641 clang::Sema::BuildResolvedCallExpr(clang::Expr*, clang::NamedDecl*, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, clang::CallExpr::ADLCallKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3d641)
#19 0x0000000006c3e76a clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c3e76a)
#20 0x0000000006c4040c clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c4040c)
#21 0x000000000675d087 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x675d087)
#22 0x0000000006755eda clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6755eda)
#23 0x0000000006758137 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6758137)
#24 0x00000000067581c9 clang::Parser::ParseAssignmentExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67581c9)
#25 0x000000000675c879 clang::Parser::ParseExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x675c879)
#26 0x00000000067f2079 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67f2079)
#27 0x00000000067e97e4 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+++0x67e97e4)
#28 0x00000000067ea629 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67ea629)
#29 0x00000000067f278b clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67f278b)
#30 0x00000000067f2f9a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67f2f9a)
#31 0x00000000066e91ab clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e91ab)
#32 0x000000000671f57d 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+++0x671f57d)
#33 0x00000000066dc5ce clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66dc5ce)
#34 0x00000000066dcd6f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66dcd6f)
#35 0x00000000066e45e3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e45e3)
#36 0x00000000066e54f5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e54f5)
#37 0x00000000066d75fa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66d75fa)
#38 0x00000000049c8d28 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49c8d28)
#39 0x0000000004cbcd15 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cbcd15)
#40 0x0000000004c38f6e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c38f6e)
#41 0x0000000004dae5f1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4dae5f1)
#42 0x0000000000db0c0f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdb0c0f)
#43 0x0000000000da786a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#44 0x0000000004a30739 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 0x0000000003f68e24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f68e24)
#46 0x0000000004a30d4f 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 0x00000000049f2fbd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49f2fbd)
#48 0x00000000049f404e 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+++0x49f404e)
#49 0x00000000049fbae5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49fbae5)
#50 0x0000000000dad0c5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdad0c5)
#51 0x0000000000c61054 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc61054)
#52 0x000070dcf8e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#53 0x000070dcf8e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#54 0x0000000000da7315 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda7315)
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/eJzkW99zozjy_2vIi8opEL8f8kCc8X5nv9mbVJy715QQja0NRpwkMs7-9VeSsDEYO5O9e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