RFR: 8332697: ubsan: shenandoahSimpleBitMap.inline.hpp:68:23: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int' [v3]

William Kemper wkemper at openjdk.org
Mon Sep 30 17:01:36 UTC 2024


On Fri, 27 Sep 2024 23:39:15 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> Use a template version of `right_n_bits` to use the same type for minuend and subtrahend.
>
> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix comments

I tried that, but there is a warning at the macro declaration:

// (note: #define used only so that they can be used in enum constant definitions)
#define nth_bit(n)        (((n) >= BitsPerWord) ? 0 : (OneBit << (n)))
#define right_n_bits(n)   (nth_bit(n) - 1)

There are many usages of `right_n_bits` that use an unnamed enum constant, which will not accept a cast from a numeric type.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21236#issuecomment-2383717052


More information about the hotspot-gc-dev mailing list