<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94234>94234</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h:260: int into long doesn't look right ?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
code-quality
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
Static analyser cppcheck says:
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h:260:18: style: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
Source code is
uint64_t NImms = ~(Size-1) << 1;
Maybe better code:
uint64_t NImms = ~((uint64_t) Size - 1) << 1;
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU02PmzAQ_TXDZZQIxoTAgQObCGmlbi_be2XsAdx17NQ2kdJDf3tF9lPV9tYLQvPx3vPzs4zRTI65hd0d7I6ZXNLsQ6vVIIoyG7y-to9JJqNQOmmvkQOq81nNrJ4wymsE0UF-hPzla-3lBNRbMwD132SYOAH1XRfUXJVA_cPhuXjkqN4bndaBYzRuevCa43YG0VGVg-iKGkSHMV0trz_GJQwcF5vQRHzRrjF5tN5NeJHByMHyFu9HTDO_Fdbp20TyKC_eaLQ-RvQjGjf6cJLJeAd0WJccXv2Cs7zwZ0NbhN1dCotTX7ybDjKm7qbixC7B7vjRi0e_BMWovF75P3YQF-NSVX5P-PX-dIoI4oi_gepH84s3BVCDIA4gDliAuPu4-SCvA-PAKa0X4TX_5f8_kYHq184KvxLhBj-nynQrdCMamXFb7It9SXVV59ncNntJpd4VxdhUe9JNOZKqK1GxVDVVI2empZzKvMpFsRMF5dtyUGORj_VYDbIeGgVlzidp7HYNytaHKTMxLtw2JYkys3JgG29RJBqkemKnQXRv8SGgAxCt5978XKQ16boWd8cstCvgZlimCGVuTUzxnSKZZLn939G8hdG41-xpz9EB7RNa758wmGlOCKLPlmDbOaXz7alQD9RPJs3LsFX-pudF1ir_HPwPVqusmysRqH825tLSnwAAAP__JdwkNg">