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

    <tr>
        <th>Summary</th>
        <td>
            [clang][bytecode] Assertion `getElemType(A).getTypePtr() == getElemType(B).getTypePtr()' failed.
        </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/sqG78qePo
```c
int strcmp(const char *, const char *);

#define S "\x01\x02\x03\x04\x05\x06\x07\x08"

const char c[] = {S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7]};

const unsigned char uc[] = {S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7]};

int test(void) { return (strcmp(c, (const char *)uc)); }
```

Backtrace:
```console
clang: /root/llvm-project/llvm/tools/clang/lib/AST/ByteCode/InterpBuiltin.cpp:215: bool clang::interp::interp__builtin_strcmp(clang::interp::InterpState&, clang::interp::CodePtr, const clang::interp::InterpFrame*, const clang::CallExpr*, unsigned int): Assertion `getElemType(A).getTypePtr() == getElemType(B).getTypePtr()' 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.      <eof> parser at end of file
2.      <source>:9:5: LLVM IR generation of declaration 'test'
3.      <source>:9:5: Generating code for declaration 'test'
 #0 0x0000000004028478 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4028478)
 #1 0x00000000040258a4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40258a4)
 #2 0x0000000003f6a0d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000073bd4a442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000073bd4a4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000073bd4a442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000073bd4a4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000073bd4a42871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000073bd4a439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000007af157e clang::interp::interp__builtin_strcmp(clang::interp::InterpState&, clang::interp::CodePtr, clang::interp::InterpFrame const*, clang::CallExpr const*, unsigned int) (.isra.0) InterpBuiltin.cpp:0:0
#10 0x0000000007b02b42 clang::interp::InterpretBuiltin(clang::interp::InterpState&, clang::interp::CodePtr, clang::CallExpr const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7b02b42)
#11 0x0000000007e31cf1 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitBuiltinCallExpr(clang::CallExpr const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7e31cf1)
#12 0x0000000007e3935e clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCallExpr(clang::CallExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7e3935e)
#13 0x0000000007e3fa70 clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7e3fa70)
#14 0x0000000007e348aa clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7e348aa)
#15 0x00000000079ca061 clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79ca061)
#16 0x00000000079bd69f clang::interp::Context::evaluateAsRValue(clang::interp::State&, clang::Expr const*, clang::APValue&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79bd69f)
#17 0x0000000007936fd3 EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#18 0x000000000793b3e6 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&, clang::ASTContext const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x793b3e6)
#19 0x00000000048927a8 clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48927a8)
#20 0x000000000438235e clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x438235e)
#21 0x00000000043f3404 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#22 0x00000000043e7890 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#23 0x00000000043e9a4b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#24 0x00000000043e7bee clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#25 0x00000000043ebfcc clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43ebfcc)
#26 0x00000000044f338c clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44f338c)
#27 0x00000000044fbaee clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44fbaee)
#28 0x00000000045039ec clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45039ec)
#29 0x000000000456ae3e clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x456ae3e)
#30 0x000000000457ca84 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x457ca84)
#31 0x00000000045e7edd clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e7edd)
#32 0x00000000045e2ea4 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e2ea4)
#33 0x00000000045e3de0 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e3de0)
#34 0x00000000045ee123 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#35 0x00000000049cec70 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#36 0x00000000049be144 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49be144)
#37 0x00000000066da4e4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66da4e4)
#38 0x00000000049ca7e8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49ca7e8)
#39 0x0000000004cbedb5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4cbedb5)
#40 0x0000000004c3af5e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4c3af5e)
#41 0x0000000004db06d1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4db06d1)
#42 0x0000000000db082f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xdb082f)
#43 0x0000000000da74da ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#44 0x0000000004a321d9 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 0x0000000003f6a574 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f6a574)
#46 0x0000000004a327ef 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 0x00000000049f4a8d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49f4a8d)
#48 0x00000000049f5b1e 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+0x49f5b1e)
#49 0x00000000049fd565 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49fd565)
#50 0x0000000000dacce5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xdacce5)
#51 0x0000000000c60ed4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc60ed4)
#52 0x000073bd4a429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#53 0x000073bd4a429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#54 0x0000000000da6f85 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xda6f85)
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/eJzkW11z27iS_TXwC0oqCvx-8AMtW9lMZWpTUSr7qALBpswNRXAA0JH3128BoESCkhw7kWfurTs1UVEk0DjndAPdoGAqZbVtAG5ReIfC-xvaqUcubr_PqBD8h7zJefF8-wVawYuOgUB-hrzsUalW6kuyQmS15UXOazXnYovI6v8QWcm_PsTJX_CZIy9DkWf_Z8jLqkZhqQTbtYgkjDdSYfZIBUYkQ2SJp3dS5N9pE16GiF9AWTWA1xgRgsLl3luYT3vtm8_AfIbmMzKfsflMdBdjZzQCs4wx8u8xiu_WKLzzUHivcejrxeiajK790XUwug5H19HoOtbX8f2RiUXQNUb2wkLp_iEs2h0KpEIkeeJVgUiqR8cCVCcajEgy-EqbOOOztGPaTcZTWJseOdyOcUfZdyUoAxs6QzjwRvIatCI1bbbIzzAiK8G5QmRV10-7WSv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