<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/147686>147686</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy 20 crashes in RegionStoreManager
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
BobIsOnFire
</td>
</tr>
</table>
<pre>
The best I could minimize is this, repro crashes on line 7 (`*m_ptr = '\0'`):
```cpp
class A
{
public:
A()
: m_ptr(m_buf)
{
*m_ptr = '\0';
}
private:
char m_buf[64] = {0};
char * m_ptr;
};
A a;
```
[crash.log](https://github.com/user-attachments/files/21140523/crash.log)
Reproduces in godbolt as well (with trunk clang-tidy): https://godbolt.org/z/PMaToWrWG
Using 20.1.7 compiled with assertions, I get following assertion error with the same stack:
```
clang-tidy: /export/home/nikita.akatiev/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = clang::ento::nonloc::CompoundVal; From = clang::ento::SVal]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
```
I've also ran a git-bisect, which led me to this commit 820403c4e04db1f4adc8528bec33d393a5be3856. Somewhat surprisingly, `clang --analyze` doesn't seem to crash on this code.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VMFupDgQ_ZrqSyktt2kDfeBAd5ZVDqNdTbI7x5ExBXhjbGSbZHu-fmXoJKMZzUpIGKreq2fXc8kQ9GCJKhBnEPc7ucTR-ers2ofwh220p13rumv1NBK2FCI-oHKL6XDSVk_6G6EOGEcdgF_Q0-wdKi_DSAGdRaMtYYHAS8gZ8Hr6OkePkN0j8ALEhaVXipwgq4GtT862R80zsFoZGQKugeIMrJ6X1mi1ZSMi1ombn25fkNW41gBeTl_bpf8utMLxVyKy83ve_SZk9vpFRvoopUbpcWMV5_wI4n4jKc4sgTaGNQn4m4z153sUW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