<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58032>58032</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb] SBValue::GetAsUnsigned overflow doesn't respect underlying integer type range
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Michael137
</td>
</tr>
</table>
<pre>
Based on discussion in [D134493](https://reviews.llvm.org/D134493#3811225).
Repro:
```
❯ cat overflow.cc
#include <stdint.h>
int main() {
int8_t i8 = -1;
int32_t i32 = -1;
int64_t i64 = -1;
return 0;
}
(lldb) script
>>> lldb.frame.FindVariable("i8").GetValueAsUnsigned()
4294967295
>>> lldb.frame.FindVariable("i32").GetValueAsUnsigned()
4294967295
>>> lldb.frame.FindVariable("i64").GetValueAsUnsigned()
18446744073709551615
>>>
```
Observe how the `i8` overflow is actually a u32 instead of the `255` which is what one would expect based on the behaviour of the last two overflows. Probably a bug we should fix if feasible
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VE2PmzAQ_TXmMlpkbD4PHJJmt6eqVavutTIwBFcORLYJm3_fMdlkd9s9tIdKlsF-nvHM4z2aqTvXW-Wwg2mETrt2dk7Tqx6BZdtdItO0kizbMVEO3h8dkxsmHmhYPGlcXGzM6RBPdk9b19NCyjJJhMiYqGLGd4xvLvNXPNopZLjs5fx5XJb3glU7tnmAVnmYTmh7My1x28IzLqQeWzN3CEx-cL7To48HJu8vMK3goPRIhdK1wIrtZR-oFV_-8KBLitvBXcLka0iKgEnxLpinAczTP0GLfrYj8NsWK3avW6UyjOmaUIprrT76NyAVvQ4IZ-LeqgPGD3rsHpXVqjG4NiF0mAKHH9E_KjPjxn0fnd6P2F26vGRLRZVWeSGq7N-yS_Ff0-fpX6VPyjTNizTlhSx4lWVJnvx-0ftyWefPjUN7QhimBfxAysg5sZbzm35AO1Ctn5UxZ1Aw04fWo_OoSPD9NURkWYhZBt0OIWAZggJHhGWaTQf4dMTWQ3O1SYhqcFAnPc32msYo58Ev0-1mF8MXOzXESLi4mfewILhhzdjrJ9A99KicJsYirJM8T6UoEllEXS27SlYq8tobrMmGq5KyHXzbrkQGB8kN0frC6Eu_3YSOTFB4kqhb657HDq0563EfJI17tODPRwSrxj1GszX1W2fvtR_mJm6nAy2CvZ8fd2Ten5SQltq5GR29ZCWXIhrqrG8UVm0vlESsOsS-FDlWJS_6LKO2IqMaNC40Q6q4OENQS5GuBReCV6LkCc9kEecdcpU12FS8aRpZsZQj-drcfjSRrddqiFFHoNHOv_yFIuVWQlbaQn41-2Gy9Sf6sgpNoHetvV4L_wUMhHmT">