kvx: ubsan: integer overflow
authorAlan Modra <amodra@gmail.com>
Tue, 22 Aug 2023 23:04:12 +0000 (08:34 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 23 Aug 2023 01:33:52 +0000 (11:03 +0930)
commit990f9a1d13e3e6fa9443d23fdd146528d4f21159
tree44aa5f6324a0f61f67c4f851e1bbde6e635208f6
parent847fb383d83039b194f68d9e09974a3de4095eb5
kvx: ubsan: integer overflow

This fixes a few places where ubsan complains about signed integer
overflow when running the testsuite, and that clz(0) is undefined.
When fixing the clz problem, I also noticed that we'd get complaints
if pval is ever LLONG_MIN.  Fix that by using unsigned arithmetic.

* config/kvx-parse.c (get_token_class): Avoid signed overflow.
Don't clz(0).
* config/tc-kvx.c (PARALLEL_BIT): Avoid signed overflow.
gas/config/kvx-parse.c
gas/config/tc-kvx.c