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

    <tr>
        <th>Summary</th>
        <td>
            clang crash on x86_64-linux-gnu: clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Compiler Explorer: https://godbolt.org/z/Y9aPsbM16
```console
<source>:59:5: warning: incompatible redeclaration of library function 'printf' [-Wincompatible-library-redeclaration]
   59 | int printf(char fmt, ...);
 |     ^
<source>:59:5: note: 'printf' is a builtin with type 'int (const char *, ...)'
<source>:63:3: error: incompatible pointer to integer conversion passing 'char[3]' to parameter of type 'char' [-Wint-conversion]
 63 |   __builtin_dump_struct(a, printf);
      | ^~~~~~~~~~~~~~~~~~~~~
<source>:63:3: note: in call to printing function with arguments '("%s", "struct A")' while dumping struct
<source>:59:17: note: passing argument to parameter 'fmt' here
   59 | int printf(char fmt, ...);
      |                 ^
<source>:63:3: error: cannot compile this scalar expression yet
   63 |   __builtin_dump_struct(a, printf);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected placeholder builtin type!
UNREACHABLE executed at /root/llvm-project/clang/lib/CodeGen/CodeGenTypes.cpp:581!
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 -fno-verbose-asm -c --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.      <eof> parser at end of file
2.      <source>:61:6: LLVM IR generation of declaration 'test'
3.      <source>:61:6: Generating code for declaration 'test'
 #0 0x0000000003c56df8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c56df8)
 #1 0x0000000003c54b04 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c54b04)
 #2 0x0000000003ba2068 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007ee5e2842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007ee5e28969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007ee5e2842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007ee5e28287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000000003bad9ca (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bad9ca)
 #8 0x00000000040ff71b clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40ff71b)
 #9 0x00000000044982ce (anonymous namespace)::ScalarExprEmitter::VisitExpr(clang::Expr*) (.isra.0) CGExprScalar.cpp:0:0
#10 0x00000000044ae113 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#11 0x00000000044b00eb (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#12 0x00000000044b705b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#13 0x00000000044ae4d1 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#14 0x00000000044b3dac clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44b3dac)
#15 0x000000000443c7fe clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x443c7fe)
#16 0x00000000044606d5 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44606d5)
#17 0x0000000003fc23b5 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fc23b5)
#18 0x0000000003fca024 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fca024)
#19 0x0000000004032ff4 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4032ff4)
#20 0x0000000004045d38 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4045d38)
#21 0x00000000040adb4a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40adb4a)
#22 0x00000000040a8dd5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40a8dd5)
#23 0x00000000040a91bb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40a91bb)
#24 0x00000000040b3983 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#25 0x00000000045e2b06 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#26 0x00000000045d3688 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45d3688)
#27 0x00000000065ca1f4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65ca1f4)
#28 0x00000000045e0668 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e0668)
#29 0x0000000004899a89 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4899a89)
#30 0x000000000481c48e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x481c48e)
#31 0x00000000049862ce clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49862ce)
#32 0x0000000000ce1c7f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce1c7f)
#33 0x0000000000cd971a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#34 0x0000000004624ad9 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
#35 0x0000000003ba2514 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ba2514)
#36 0x00000000046250cf 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
#37 0x00000000045ea3dd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45ea3dd)
#38 0x00000000045eb4cd 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+0x45eb4cd)
#39 0x00000000045f2a45 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45f2a45)
#40 0x0000000000cdeac3 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcdeac3)
#41 0x0000000000bac364 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbac364)
#42 0x00007ee5e2829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#43 0x00007ee5e2829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#44 0x0000000000cd91c5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd91c5)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
Code:
```c

struct FILE;
extern int vfprintf(struct FILE *s, const char *format, __builtin_va_list arg);
extern int vprintf(const char *format, __builtin_va_list arg);

extern __inline __attribute__((gnu_inline,always_inline)) int
vprintf(const char *x, __builtin_va_list y)
{
  return vfprintf (0, 0, y);
}
#include <stdint.h>

struct X {
  int n;
};

struct A {
  char i1;
  signed char i2;
  unsigned char i3;
  short i4;
  unsigned short i5;
  int i6;
  unsigned int i7;
  long i8;
  unsigned long i9;
  long long i10;
  unsigned long long i11;

  float f1;
  double f2;
  long double f3;

  void *p1;
  char *s1;
  const char *s2;
  char s3[10];

 struct X x1;

  struct {
    int n1;
    struct X n2;
  };
  union {
 int u1;
    int u2;
  };

  int b1 : 5;
  int : 0;
  int b2 : 3;
 int : 5;

  _Complex int ci1;
  _Complex double cd1;
};

int printf(char fmt, ...);

void test(struct A *a) {

 __builtin_dump_struct(a, printf);

}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWltz2ziy_jX0C0oqErw_-IGW7UymMufkxDmZ3ScVCIISNhDAAkBH3of97VsAeJd8y2i2dmtViSyBQOP7uhvdTaqRUnTHCbn24hsvvr1Crd4LeV3SBF-Vonq63ohDQxmR4O7YMCGJ9MIC7LVulBcWHrz34P1OVKVgei3kzoP3f_fg_V9z9FmVvwWJ5xde4rt_WHAlGDFD4UaJVmLihXdeWMS5eTNyfyDJKd-Zj5RjcWiQpiUjQJKKYIYk0lRwIGrAaCmRfAJ1y7Ed82DaSMp17cEUePHN6vepgFU3fzUT5MW3nl8AAOIceOkGUK5BLyTDeyRBfdAe3ID1eu3B3AtvzHQz07y8-O4lKlxoYv7OgFEFEChbyjTl4AfVe6CfGmLmmL3NroIrDezeHiwme8P0dLMk9MLC_AdESiFPtNYIyjWRQAtDjeyIBFjwRyKV0VhjTM93ZnOznxffhEYhMDXzGyTRgZjFoh4w2mmjevVqlNapMgk79Wy3Hctt1R6ardKyxdqDGTKUen30GnXqTDdGpf8483qJea9mygFGjFnsRrxhNjiH1TSSu_ZAuFaGigczD0IPxsr-2QAPQgcSFHbEaBz82FNGgGFgxHUkzts8SKdoet32e85V6sHUOlYK9kSSn3DBQWHL11mfPOMmGHEuNMDubAO9pwoojBiSgBwbSZT1kCei3W5_jlnnFv5_To4NwZpUoGEIk71gFZHDYTE-6MHATPyfL3fF5pfi5tMdIEeCW7MEmdNzL4XQHrxn7PGwaqT4GzHg7jFD3AQmRksP3m9ERT4QPn76-tQQtcZNY0yZBW6Tz5_uioc7oNryQLU9szsgSSOkNeUi_FG9b8s1Fodu71MIVKmWKA_eA8Qrc0hZWxm1E4AlUntQIvxdS4SJ0yNppMBEKVKBzpBwY1cipQSmyDCWLQcKS9rotecXDx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