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

    <tr>
        <th>Summary</th>
        <td>
            [clang][static analyzer] Crash when program contains __builtin_bit_cast
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:static analyzer
      </td>
    </tr>

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

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

<pre>
    The static analyzer crashes when passed a small program containing __builtin_bit_cast.
```
$ cat test.cpp
int *a;
char b[4];
void c() { a[__builtin_bit_cast(int, b)]; }
$ clang++ --version |& grep version
clang version 19.0.0git (git@github.com:llvm/llvm-project.git dd82fd4744397e0510c8204f1a6031441e21858e)
$ clang++ --analyze test.cpp
clang++: <HOME>/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = clang::ento::NonLoc, From = clang::ento::SVal]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
...
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VMtu7CgQ_ZryphQL8_Bj4UU_0prFnYeUaLYRxrTNjA0W4IwyXz_C7uTm9txILbUpiuLUOZySIZjBat2COII4Z3KNo_Ot87M3Ietc_9Y-jxpDlNEolFZOb_9qj8rLMOqA_4za4iJD0D1KDLOcJly8G7ycUTkbpbHGDvjy0q1misa-dCa-KBliDuQM5AAluf32JeWoZMSoQ8zVsuxRYyMCPUhgxz2gRumxA3HkIM4f0VdnelRAa6ANQnVECeL4_5uB1sZGoCfsgDZ7AYTq_AnBJO0A9Aj0iA8Pr9oH4yxCdQJa4uD1grfYDU1Kfw9h0eQkJ4NJkOvBROBpMa5drtwM7DBNrzPQS_p7WLz7S6uYp-y-r-m15xXnrKk0EQVRNSX8WsiSsILzQtOiFrVOmL9AelPnjr1POcAOCOz0y--_PgJ7vENxWwK9GKumtdffA0_rsjifMk4yRGOHfAR2EGWZCvZaTfFt0UBruUaXyN-OsQOww41w5WyIePFuRqDlpo84PjsEdr71sGVrG93-9Zuz35xKIu2Hvsp7-lNOm4QHPISgfdyUKokJEtjp2W1t1ikp3ZmuLhEo3WCx0_Pbvp82pR_WWduI7orGKjcvMppu0rj3VgClQCu8SjPp_vZ6__j2eHh6xLB2s4kosVsH9DpRhdHhGOMSEkx6AXrp1iHkiZjc-QHoBaXt8cY0xlHvlsJOqr-jl0qn3hevF--U3uwV3Or3cDopQ3DKyKh79KvFoLxZ3k2V5_nHE7mzWda3rG9YIzPdFlVRlYQzxrOxJWV1pZxe-4YzwhrR12XXS9ZwIUpKrn1mWkooJyURRVnUgue0qpmi17IRSqqKdMCJnqWZPprMTAirbhvOmzKbZKensE0ZSt-lvJsqiWJxzny7PctEGHAymRC_E5dFE6dtWO01xBnE8b6MOONpI3OfTj-Oo_CTYZStfmp_lOuTZz9scOeWrb0A9LJ3-NrS_wIAAP__J6GjLg">