<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54129>54129</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang crashes during compiling C code
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
narekchj
</td>
</tr>
</table>
<pre>
Here is a simple example to reproduce the problem:
```
// It should be in c file, the same code works for c++
struct A;
typedef struct A* __ptr32 B;
typedef B* __ptr32 C;
struct A
{};
typedef B D;
C f1();
C f2();
int main()
{
D* f = (1) ? f1() : (D*)f2();
return 0;
}
```
Here is a failure message:
_> wrong cast for pointers in different address spaces(must be an address space cast)!
> UNREACHABLE executed at ./llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:2013!_
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUslu2zAQ_RrqMqghkU4cHXTwmhQoemjRs0GRI4kJtYBLk_x9R4yrJHUBQpr1zSPn1aN-rR7QIRgPErzpJ4uALzL9wwgOJzfqqMjpEMiuLfZMbFl-YPnf721-OW8uP9GBrwF8N0aroSb0ARQ0xiLj-4TkZY-gRo3wPLonD83oQDG-m09C8cFFFWDLxCUQXifU2MCS4Fs4n6fgBIfdVdXuY3q_pJfmN6abHdscrnvhPbaHpmD8jvHyY4j_EzJDgF6a4RJewJMBBEdkGmDiAFRBeCXZpwWZnO2cmMvIvUIH2kKIboB8Cc20__f276tspLGRnB69ly0uKzszcYRnNw4tKOlDevhppAug8_OatGkaAqELSa0dNYOfpEJPnPpI9bRMOXzOJaCZMC8upGjEr-8_jtv9w3b37Uh6QhUDapABVqQNa3_3X0hLj6io76SsHNo5bGr67kkU9zjM1v3xZXI_lbTSrdQ00R14Xggac4aP-st0JXQpSpkFEyxWCQ-Uk75DDzo6M7tjPxk7W_ukuyw6W3UhTH5-miTZ1oQu1iuqvHC8pmq8j_NbnG7WBS-zrtJyU97ldVE0iKi1klpwflcKRQWlFreZlTVaX7EbUiQf8BkSBNns5pCZiuec5yIvikLc5nyFShSyFGsp13UhN2u2zpGEZVczj9Xo2sxViVIdW09Ja3zw70npvWkHxDSO8GUM3eiqQTp8Ut1jlmZXifsf0UItxQ">