RFR: 8332697: ubsan: shenandoahSimpleBitMap.inline.hpp:68:23: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int' [v4]
Henry Lin
duke at openjdk.org
Mon Jul 22 22:09:31 UTC 2024
On Mon, 22 Jul 2024 21:16:07 GMT, Henry Lin <duke at openjdk.org> wrote:
>> Cast the result of `nth_bit(n)` to `uintptr_t` to prevent signed integer overflow error reported by `ubsan`. Unsigned overflow is not undefined behavior and is not checked by `ubsan`.
>
> Henry Lin has updated the pull request incrementally with one additional commit since the last revision:
>
> formatting
Thanks for the feedback. I reverted my changes in `globalDefinitions.hpp` and added an unsigned version of `right_n_bits` in `shenandoahSimpleBitMap.hpp`. This new unsigned version replaces the usages that caused undefined overflow behavior in the `shenandoahSimpleBitMap` files.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20164#issuecomment-2243893659
More information about the hotspot-dev
mailing list