Closed khilangudka closed 7 years ago
I think that this patch will break for numbers that are between 2^31 and 2^32 being assigned to __uintcap_t
I can confirm that it works fine with assigning 2^32-1 to a __uintcap_t. The underlying APInt has a bit width of 64 bits.
Please commit the fix then.
The following code:
__intcap_t minusfive = -5
results in this IR:
Note that the value being set as the offset is -5 in 32-bit two's compliment rather than 64-bit. This causes the CHERI C test
intcapmath
to fail.I think this patch fixes this bug: https://gist.github.com/kgudka/b0c7b3c59d1f96ab1545fa257417f81c